Say I have several cron scripts that need to run every 15 minutes. I could set them to run: */15 * * * *
, but then they all run at the same time. It seems silly for the server to sit idle for several minutes and then suddenly try to execute a dozen scripts all at the same time.
Is there a way I can have one script run at minute 1, 16, 31, 46 and another at 2, 17, 32, 47?
In other words, I want each script to run every 15 minutes, but I don't care that they run specifically on the quarter hour marks.
Answer
You're making this harder than it needs to be. Put them all on the same line, separated by semicolons:
*/15 * * * * command1 ; command 2 ; command 3
It will run command1
, wait for it to finish, then run command2
, wait for it to finish, and so on.
No comments:
Post a Comment