Reputation: 424
I have a lot of php-scripts which I would like to execute as cronjob. It´s important that those scripts are executed in the right order and are not running at the same time. How can I set up cronjobs which run after each other?
Upvotes: 4
Views: 3001
Reputation: 263257
Each cron job runs when it's scheduled to run, regardless of whether any other cron jobs happen to be running.
Just make a cron job that executes several commands sequentially:
* * * * * command1; command2; command3
The command (in this case command1; command2; command3
) is executed by /bin/sh
(or by a shell you can specify by setting SHELL
in your crontab). /bin/sh
, or any shell worthy of the name, knows how to execute commands sequentially.
If there are a lot of commands you can put them into a shell script and execute that from cron
.
Upvotes: 7