hexparrot / mineos-node

node.js implementation of mineos minecraft management
GNU General Public License v3.0
335 stars 169 forks source link

repeated tasks not working #109

Closed wackoamd1 closed 8 years ago

wackoamd1 commented 9 years ago

im running mineos on freenas. i want to run a restore point every 45 minutes between 11am and 2am so my cronjob looks like: /45 11-2 * * it runs at 11am but not every 45 minutes after that.

my backup task works flawless ( 0 /2 * * ) it backs up every 2 hour.

it just looks like the same formula doesn't work for minutes . is this a bug

hexparrot commented 9 years ago

Does the log /var/log/mineos.log show the attempt to create a restore point?

The FreeNAS plugin for MineOS (not developed by me) won't always download the latest commit available in git (by design). For example, in the latest commit, there are a few changes that help indicate that the cron expression in MineOS uses the seconds value--6 values rather than 5.

See https://www.npmjs.com/package/cron for more detail on the exact cron implementation; filling it in in the expect 6 value format might make it operate more dependably.

0 */45 11-2 * * *

hexparrot commented 8 years ago

So there are two issues at hand.

The first and foremost problem it turns out is that cronjob hours work on 24 hour time. So 11-2 actually registered as 1, 2, 11, 12. Your intended behavior, however, would require 11-14.

The second problem is that */45 only works on a single-hour basis. So I don't believe it's possible to do a rolling 'every 45 minutes'. Customary / values are usually in nice, even divisors of 60, such as */15 or */30. */45, on the other hand, only does minute 0 and minute 45, of each of the hours. So in other words, "every 15 of each hour" or "every 30 min of each hour", but not "every 45 starting from 11".