three Cron jobs runs every two days alternatively not in same day
How can i set three cron jobs for every two days interval but not runs all.
This is is my three cron job process:
0 20 */2 * * /usr/local/bin/ruby /var/www/html/data_download1.rb >/dev/null 2>&1
0 20 */2 * * /usr/local/bin/ruby /var/www/html/data_download2.rb >/dev/null 2>&1
0 20 */2 * * /usr/loc开发者_如何学运维al/bin/ruby /var/www/html/data_download3.rb >/dev/null 2>&1
You can use 1-31/2
for one task and 2-30/2
for the other to specify alternating days. This will fail on months with odd numbers of days as the 1-31/2
job will run twice in a row.
If you absolutely must have it right, you can check whether the number of days since a particular date is odd or even and have one script abort if it's odd and the other abort if it's even.
精彩评论