Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash monitoring background jobs

#!/bin/bash

# when running "some commands" in the background in your script with '&' 
# and want to wait until they are finished, 
# you can check the number of background jobs in a loop with the jobs command

while [[ $(jobs -r | wc -l) -gt 0 ]]; do
sleep 1
done
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #bash #monitoring #background #jobs
ADD COMMENT
Topic
Name
8+9 =