I have files named like:
File1_01.sql
File1_02.sql
File2_01.sql
File2_02.sql
I need to run all the scripts for File1 first (but these can be done in parallel), then all the scripts for File2. What's my best way to do this?
Thanks,
-Scott
I have files named like:
File1_01.sql
File1_02.sql
File2_01.sql
File2_02.sql
I need to run all the scripts for File1 first (but these can be done in parallel), then all the scripts for File2. What's my best way to do this?
Thanks,
-Scott
I don't know about "best" way, but I would probably not do it in parallel, just something simple like:
for sql in *.sql; do
mysql options <"$sql"
done
If you need to do it in parallel:
for prefix in File1 File2; do
for sql in ${prefix}_*.sql; do
mysql options <"$sql" &
done
wait
done
This will first take the File1*
files and start MySQL in parallel. Then wait for them to end before doing the same with all the File2*
files.