A common way to chain overnight jobs on one machine: wait until the render process is gone, then run the finishing step. It looks harmless:
while pgrep -f "render_shot.py" >/dev/null; do sleep 30; done
bash finish.shIf this loop runs inside bash -c '…', or inside a script whose command line contains render_shot.py, then pgrep -f matches that shell too. The render finishes, the loop keeps finding "render_shot.py" in its own command line, and the finishing step never starts. On the QX-Core render this cost 40 minutes before anyone noticed.
Fix 1: the bracket trick
while pgrep -f "[r]ender_shot.py" >/dev/null; do sleep 30; doneThe regex [r]ender_shot.py still matches the text render_shot.py, but the literal string [r]ender_shot.py in your own command line does not match it. Same trick works for pkill -f, where the self-match is worse: it kills your own shell.
Fix 2: match the real binary
pgrep -f "[h]ython-bin render_shot.py"Fix 3: do not poll at all
hython render_shot.py && bash finish.sh
# or, if the render is already running in this shell:
wait "$RENDER_PID" && bash finish.sh