简体   繁体   中英

Running a cron job every 2:30 on every day?

If I creating cronjob to running for every 2:30 the command will run? (It mean, my cron will running after 90 minutes for every hours.)

the command like: 30 */2 * * * /command/xxx => that's right?

Please help?

Your cron expression 30 */2 * * * will run the command every 2 hours at 30 mins past the hour ie00:30, 02:30, 04:30, 06:30 and so on.

If you want to run your command at intervals of two and a half hours ie 00:00, 02:30, 05:00, 07:30 and so on, you need to set up two crons:

0 0-20/5 * * * runs at 0 mins past the hour, every 5 hours between 00:00 and 20:00 inclusive ie 00:00, 05:00, 10:00, 15:00 and 20:00

30 2-22/5 * * * runs at 30 mins past the hour, every 5 hours between 02:00 and 22:00 inclusive ie 02:30, 07:30, 12:30, 17:30 and 22:30

On the other hand, if you want to run your command only once every day at 02:30 use 30 2 * * * .

sudo crontab -e

然后添加:

30 2 * * * /enter/your/command

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM