function _abc {
:
1 min task
:
_check &
}
function _check {
wait for the previous calls of _check to complete
:
15 mins task
:
}
function abc loops depending on number of tasks. It is imperative that _check is backgrounded because function abc needs to keep on working and not wait for function check to complete
So basically, what I need is for the function check to be running one at a time and not all together. That is, the remaining calls of function check should be queued up and run one at a time once the previous one finishes.
waitwhich will block until any backgrounded children have terminated.$!. You can alsowaitfor a specific process to end withwait $PID(or, in this case,wait $!.)_check's PID as an argument to_check. If no argument is given, start_checkdirectly, orwaitaccordingly.