Bash – Unix Cron : Can we set cron jobs to run at the same time

bashcronunix

I created an entry in crontab to execute a job at midnight as e.g user A.

In the morning, I found there were no results of the script. Checking the /var/cron/log, I found that during that hour (same time) only a script user root was executed.

Questions:
a) Can we set multiple jobs in cron to execute the same time.
b) If no? Does this mean user root cron has precedence over any other user to execute the cron job?

here is what they look like.

root$ crontab -l
05 00 10 * * /opt/sdf/sbin/somescriptA.sh> /dev/null 2>&1 #Test

userA$ crontab -l
05 00 10 * * /opt/sdf/sbin/somescriptB.sh> /dev/null 2>&1 #Test

Best Answer

Cron can run many scripts at the same time. In fact, in Debian there are entire directories of cron scripts (ie. /etc/cron.daily /etc/cron.hourly) that execute at the same time.

If the script executes properly at a different time, why don't you try changing the time of the root cron job to determine whether the problem is with the actual timing, or a conflict between the scripts.

I also agree with turning off the redirect to /dev/null until you have everything working correctly.

Related Topic