MrBenFTW
MrBenFTW

Reputation: 23

How to run command all at once

I have a script that looks like this

cd /root/signedsh/apps
for i in $(find . -name *_Seyed.ipa) ; do
#echo $i
./sign -k "/root/cert/appX.p12" -m "/root/profile/appX.mobileprovision" -p "udidsigning" -z 9 -o "$i" "$i"
done

Now this worked fine for the first 10 files, but now I have 300 files I need to run that ./sign command with

At the moment, it waits for the first command to finish then runs it with the second command (for i in $(find . -name *_Seyed.ipa) ; do)

Is there a way it can run all 300 or so at the same time? The server is 48 cores and 256GB ddr4 on a large nvme raid 0 so it shouldn't struggle, I just don't know how to do it

Upvotes: 0

Views: 48

Answers (1)

chepner
chepner

Reputation: 531355

Run each command in the background (and don't use find):


shopt -s globstar
cd /root/signedsh/apps
for i in **/*_Seyed.ipa ; do
  ./sign -k "/root/cert/appX.p12" \
         -m "/root/profile/appX.mobileprovision" \
         -p "udidsigning" -z 9 -o "$i" "$i" &
done

Upvotes: 3

Related Questions