Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

How to terminate finished step with background running process opened? #4325

retzero ·

Hi,

I have Build > Shell/Batch Command step which creates background process.
(I want the background process alive before I intentionally kill it in another step.)
Below step prints Finished... but the step is not terminated automatically.
How can I stop this step after the main script finished?

echo "Started...

echo "while true; do date >> a.txt; sleep 1; done" > myscript.sh
chmod +x myscript.sh

./myscript.sh &

echo "Finished..."
  • solved #5
  • replies 3
  • views 959
  • stars 0
robinshen ADMIN ·

There is a "wait for finish" option in advanced section of the step, just tick that off.

retzero ·

Hi, Thank you for the guide.
But I want to make sure that the work is completely done.
Un-checking the "wait for finish" option is not guaranteed that the job is finished or not.
(Above is a simple script but I have a complicated scripts that took few minutes which is affected to following steps.)
Do you have another option for this?

robinshen ADMIN ·

With "wait for finish" enabled, QB has to wait for external process to close its output stream, which only happens when all child processes exited (even if they are launched in background).

How about defining the logic you want to make sure successful in a separate step?