user3770138
user3770138

Reputation: 51

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?

Upvotes: 2

Views: 15780

Answers (2)

Hamid Parchami
Hamid Parchami

Reputation: 7689

sudo crontab -e

and then add this:

30 2 * * * /enter/your/command

Upvotes: 0

dogbane
dogbane

Reputation: 274630

Your cron expression 30 */2 * * * will run the command every 2 hours at 30 mins past the hour i.e.00: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 i.e. 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 i.e. 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 i.e. 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 * * *.

Upvotes: 7

Related Questions