Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get sync_first in the cron job, && before lowest increment(hourly)? #18

Open
brian-lamb-software-engineer opened this issue Oct 17, 2020 · 4 comments

Comments

@brian-lamb-software-engineer
Copy link

brian-lamb-software-engineer commented Oct 17, 2020

How will i sync before the hourly?
What sync_first needs is, without otherwise careful timing that is subject-to-change, is by default, the sync command to run "with" && before the lowest interval.

How can i make my cron job look like this?

0 */4 * * * /usr/local/bin/rsnapshot sync && /usr/local/bin/rsnapshot hourly

instead of like it does now?
0 */4 * * * /usr/local/bin/rsnapshot hourly ?

Im guessing its allowed that i add a cron entry for sync interval, just as we would hourly? Im going to try this, and if it doesnt work, i cant see how sync_first can ever work without it using puppet with this module!
e.g.

  cron:     
    sync:
        hour:     '23'
        minute:   '42' 

Ill add my hiera here, because this stuff isn't easy!!!!!!!!!!!!!!!!!!!!!!!!

  # pick all defaults for a given host
  #foo.example.com:
  localhost:
    backup_defaults: false
    backup:
      /etc:         './'
      /home:        './'
      /opt:         './'
      /usr/local:   './'
      /var:         './'
      /var:         './'
    cron:
      mailto:     ''
      # At minute 9 past every hour from 6 through 23.
      hourly:
        hour:     '6-23'
        minute:   '9'
        monthday: '*'
        month:    '*'
        weekday:  '*'
      # At 23:39 on every day-of-week from Monday through Friday
      daily:
        hour:     '23'
        minute:   '39'
        monthday: '*'
        month:    '*'
        weekday:  '1-5'
      # At 01:39 on Sunday
      weekly:
        hour:     '1'
        minute:   '39'
        monthday: '*'
        month:    '*'
        weekday:  '0'
      # At 03:39 on day-of-month 2
      monthly:
        hour:     '3'
        minute:   '39'
        monthday: '2'
        month:    '*'
        weekday:  '*'
      # 5 4 1 */3 * At 04:05 on day-of-month 1 in every 3rd month.
      # At 05:39 on day-of-month 2 in every 3rd month from January through
      #   December
      quarterly:
        hour:     '5'
        minute:   '39'
        monthday: '2'
        month:    '1/3'
        weekday:  '*'
      # 4 3 2 1 * At 03:04 on day-of-month 2 in January
      yearly:
        minute:   '39'
        hour:     '7'
        monthday: '2'
        month:    '1/3'
        weekday:  '*'

    # how many, of each interval type, to keep?
    interval:
      hourly:     '18'
      daily:      '6'
      weekly:     '3'
      monthly:    '5'
      quarterly:  '3'
      yearly:     '1'

    sync_first: true
    use_lazy_deletes: true```
@brian-lamb-software-engineer
Copy link
Author

hang on, maybe i just put the sync_first: true in the wrong place? Maybe i can throw that inside the hourly cron: hourly 🤔

@brian-lamb-software-engineer
Copy link
Author

brian-lamb-software-engineer commented Oct 17, 2020

Ok, i can rightly say, that didnt work. I tried

      hourly:
        hour:     '6-23'
        minute:   '9'
        monthday: '*'
        month:    '*'
        weekday:  '*'
        sync_first:  '1'

as well as switching what you see that i original had. e.g. sync_first: true in the main definition for localhost to sync_first: '1'

Not really sure what else to do. My sync is still running, its been going for a couple hours now. So cant just slip it in before the hourly.

Im really going to have to run it in the time the hourly doesnt run, e.g. after 1800 hours, but then wait, that wont work, beacuse i need it to run hourly. man, ill have to see why its taking so long to run also. the archive was only 4.5GB..

Any help to get the sync_first correctly into the cronjob, using this module, and hiera config, would be GREATLY appreciated. Thanks.

I also wonder if its taking so long because it looks like it ran twice this most recent past. Anyway, ill share my log incase it helps. Thanks.

  [2020-10-16T18:39:50] /usr/bin/rsync -az --delete --numeric-ids --relative --delete-excluded /opt/ /archive/rsnapsh
                                                                                                                    ot/localhost/.sync/./
                                                                                                                    [2020-10-16T19:09:01] /usr/bin/rsnapshot -c /etc/rsnapshot/localhost.rsnapshot.conf hourly: started
                                                                                                                    [2020-10-16T19:09:01] Setting locale to POSIX "C"
                                                                                                                    [2020-10-16T19:09:01] /usr/bin/rsnapshot -c /etc/rsnapshot/localhost.rsnapshot.conf hourly: ERROR: Lockfile /var/ru
                                                                                                                    n/rsnapshot/localhost.pid exists and so does its process, can not continue

                                                                                                                    ==> /var/log/rsnapshot/localhost.log <==
                                                                                                                    [2020-10-16T17:16:03] echo 31532 > /var/run/rsnapshot/localhost.pid
                                                                                                                    [2020-10-16T17:16:03] /usr/bin/rsync -az --delete --numeric-ids --relative --delete-excluded /etc/ /archive/rsnapsh
                                                                                                                    ot/localhost/.sync/./
                                                                                                                    [2020-10-16T17:16:08] /usr/bin/rsync -az --delete --numeric-ids --relative --delete-excluded /home/ /archive/rsnaps
                                                                                                                    hot/localhost/.sync/./
                                                                                                                    [2020-10-16T18:09:01] /usr/bin/rsnapshot -c /etc/rsnapshot/localhost.rsnapshot.conf hourly: started
                                                                                                                    [2020-10-16T18:09:01] Setting locale to POSIX "C"
                                                                                                                    [2020-10-16T18:09:01] /usr/bin/rsnapshot -c /etc/rsnapshot/localhost.rsnapshot.conf hourly: ERROR: Lockfile /var/ru
                                                                                                                    n/rsnapshot/localhost.pid exists and so does its process, can not continue
                                                                                                                    [2020-10-16T18:39:50] /usr/bin/rsync -az --delete --numeric-ids --relative --delete-excluded /opt/ /archive/rsnapsh
                                                                                                                    ot/localhost/.sync/./
                                                                                                                    [2020-10-16T19:09:01] /usr/bin/rsnapshot -c /etc/rsnapshot/localhost.rsnapshot.conf hourly: started
                                                                                                                    [2020-10-16T19:09:01] Setting locale to POSIX "C"
                                                                                                                    [2020-10-16T19:09:01] /usr/bin/rsnapshot -c /etc/rsnapshot/localhost.rsnapshot.conf hourly: ERROR: Lockfile /var/ru
                                                                                                                    n/rsnapshot/localhost.pid exists and so does its process, can not continue






                                                                                                                    [2020-10-16T19:18:39] /usr/bin/rsync -az --delete --numeric-ids --relative --delete-excluded /usr/local/ /archive/r
                                                                                                                    snapshot/localhost/.sync/./
                                                                                                                    [2020-10-16T19:19:01] /usr/bin/rsync -az --delete --numeric-ids --relative --delete-excluded /var/ /archive/rsnapsh
                                                                                                                    ot/localhost/.sync/./

@loomsen
Copy link
Owner

loomsen commented Oct 28, 2020

Hi @brian-lamb-software-engineer , sorry for the late reply.

I fear this project is abandoned and I need someone to take ownership of it. I haven't gotten to the point where it would be acceptable to transfer to the voxpopuli org, but I hope to manage to get in touch with some of the guys there. It should see significant improvement once I manage to transfer the project.

Or you can take ownership. if you want :)

@brian-lamb-software-engineer
Copy link
Author

Thanks for the response. Fair enough. Appreciate what you did thus far. Do you remember if the sync_first is available? it seemed it was.
I will consider taking it over, after i get resettled. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants