Reputation: 199
Is it possible to make crontab run after one's execution. I read that cron jobs start from top, but run parallel, doesn't wait one to finish. Is there any way that I can do like this? For example, let's say I have 3 cron jobs.
*/5 * * * * job1
*/5 * * * * job2
*/5 * * * * job3
I want job2 to run after job1 has completed, and job3 after job2 completed.
Upvotes: 1
Views: 1366
Reputation: 631
In case you want to use the global crontab in /etc, it's simpler. The main crontab file is /etc/crontab. It contains this type of instruction:
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
so Linux uses run-parts; run-parts launch commands in alphabetical order, so just add numbers in the script like this:
and so on... Please avoid using dots or other characters that are not legal for run-parts:
Upvotes: 0
Reputation: 45045
You can have more than one command in a single crontab entry:
*/5 * * * * job1 ; job2 ; job3
Upvotes: 3