zilexa
zilexa

Reputation: 1

Cronjob every x hours between 23-16 not working

Partly using stackoverflow search I figured out how to run my cronjob every 3 hours but not between 23h-16h. That means a pause between 16h today untill 23h today. So the cronjob should start running every 3 hours at 23h and stop at 16h, then start again at 23h.

This is the result:

0 23-16/3 * * * /usr/local/bin/flexget -c /media/usb/Downloads/flexget/config.yml --cron

Now my question: Why is this not working? It does not run at all :(

I also tried:

* 23-16/3 * * * /usr/local/bin/flexget -c /media/usb/Downloads/flexget/config.yml --cron

(not sure what the difference is with 0 or with * for the minutes, rounded hours or not?)

This DOES work:

0 */3 * * * /usr/local/bin/flexget -c /media/usb/Downloads/flexget/config.yml --cron

But then it just runs every 3 hours every day, without pause between 16-23.

Upvotes: 0

Views: 544

Answers (1)

shx2
shx2

Reputation: 64368

You can always list the hours explicitly.

0 2,5,8,11,14,23 * * * /usr/local/bin/flexget -c /media/usb/Downloads/flexget/config.yml --cron

Note this is not the same as with replacing 0 minutes with *, like:

* 2,5,8,11,14,23 * * * /usr/local/bin/flexget -c /media/usb/Downloads/flexget/config.yml --cron

The latter starts on every minute on the hours specified, i.e. 2:00, 2:01, 2:02, ..., 2:59, 5:00, 5:01, ... 5:59, ...

Upvotes: 1

Related Questions