문제

How would I write a bash script that checks there are no currently running cron jobs, then does some simple action?

I am not talking about cron jobs that are scheduled to run at some point, I am referring to actively running processes.

Thanks!

도움이 되었습니까?

해결책

intresting question ;)

for pid in `pgrep cron`;do
  ps uh --ppid $pid;
done|grep -v CRON

다른 팁

You can read the crontab like this

crontab -l | grep -v "^#" | awk '{print $6}'

and check if any of the script/job is running

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top