jeudi 15 janvier 2015

If any spawned child processes fail, kill all and exit


In my script I split up a data set into input_aa, input_ab, etc. Then, I run each through the same Python script, as such:



# Execute program on each split file
for part in input_*; do
python3 $part &
done
wait


My question is two-fold: how do I detect that a Python process has failed, and when detected, how do I kill all spawned children and exit the script with a fail?



Aucun commentaire:

Enregistrer un commentaire