Welcome! » Log In » Create A New Profile

cron - timing - interval

Posted by Anonymous 
cron - timing - interval
July 07, 2016 12:12PM
Hey guys,

as i wrote here [url=https://github.com/rsnapshot/rsnapshot/issues/142]https://github.com/rsnapshot/rsnapshot/issues/142[/url] - sam-at-github thx for your answer.

i understand the concept of the retain levels, but maybe i didnt make clear my thoughts.

here is an example for a interval scheme :
##################################################

retain daily 7
retain weekly 4
retain monthly 12

here is the schedule for its interval scheme (crons) :

##################################################
44 2 * * * root rsnapshot daily # mon-sat

27 0 * * 0 root rsnapshot weekly # sun
17 1 1 * * root rsnapshot monthly # first of every month

if i would start my first backup then it results like this :
##################################################
Mon - daily.0

Tue - daily.1

Wed - daily.2

Thu - daily.3

Fri - daily.4

Sat - daily.5

On Sun i see a problem, cron would call first "rsnapshot weekly" (look at cron times), this will cause:

"daily.6 not present (yet), nothing to copy"

because of that behavior weekly.0 is skipped.

My temporarily fix looks like this :
#############################

### rsnapshot-cron

# _________________________ 1. Minute - Minutes after the hour (0-59)
# |
# | ______________________ 2. Hour - 24-hour format (0-23).
# | |
# | | ___________________ 3. Day - Day of the month (1-31)
# | | |
# | | | ________________ 4. Month - Month of the year (1-12)
# | | | |
# | | | | ______________5. Weekday - Day of the week. (0-6, 0 indicates Sunday)
# | | | | |
#__|_____|_____|_____|____|___User___Command_____________________________________________________

20 1 * * 1-6 root rsnapshot sync && rsnapshot daily

48 2 * * 0 root rsnapshot sync && rsnapshot daily && rsnapshot weekly

53 3 1 * * root if [[ -z $( rsnapshot -v -t monthly | grep 'not present (yet), nothing to copy') ]]; then rsnapshot monthly ; fi

As you can see i tried to solve the problem by paying attention to the order of the cron times and by adding the logical AND.

Maybe you can suggest a better solution. My goal is that the chronology of the backups are allways guaranteed concerning the timing.

Regards
Masi
Sorry, you do not have permission to post/reply in this forum.