rsnapshot + autoshutdown/WOL - flexible daily backups

  • Hey,


    I am using rsnapshot to backup to a second disk. To my knowledge the rsnapshot-addon uses cronjobs to backup every day (if set so) at 3:00 o'Clock.
    My problem is, that my Server is configured with autoshutdown and WOL, which works great and exactly how intended. The problem with that is that the server is mostly shutdown/hibernating at 3:00 and so no backup is generated.
    For exactly that purpose there is anacron, right? The problem is, that it is not available as an Plugin anymore.


    Is there a way how to realize a daily backup-routine, that would also perform a backup if the server is switched on on a different time that day?


    (OMV itself uses obviously something like that for its apt-get etc... so I guess it should be possible)


    Thanks in advance

    • Offizieller Beitrag

    The anacron plugin was stopped because the anacron functionality is now integrated into scheduled tasks. You can change the time of the cronjob for rsnapshot by editing /etc/cron.d/openmediavault-rsnapshot.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • You can change the time of the cronjob for rsnapshot by editing /etc/cron.d/openmediavault-rsnapshot.


    I know that i can change the time, but I actually do not have any forced uptime at all. So I want the backup only IF the server wakes up that day and not for a certain time. Basically what I understand what anacron does.

    The anacron plugin was stopped because the anacron functionality is now integrated into scheduled tasks.


    How can I then schedule the rsnapshot plugin to perform a backup a day with the scheduled tasks?


    thanks in advance

  • you can use these three thinks:
    free Webspace (e. g. hostinger.de)
    external cronjob (e. g. cronjob.de)
    WOL over Web (e. g. http://ifatwww.et.uni-magdeburg.de/wol/)


    Build a script with a redirection to (e. g. http://ifatwww.et.uni-magdeburg.de/wol/). You have to use a direct link to sent a WOL package.
    For exemple: http://ifatwww.et.uni-magdebur…00000000&Wecken=AUFWECKEN
    Upload the redirection (e. g. php file) to a free Webspace. Make a Account on cronjob.de and use it to open your site on the free Webspace to your prescribed time.


    For more informations sent me a pm!

    Server:
    Mainboard: Gigabyte GA-H97N-WIFI - CPU: Intel Core i3-4170T - CPU Kühler: EKL Alpenföhn BEN NEVIS - Gehäuse: BitFenix Prodigy ITX - RAM: 8GB Crucial Ballistix Sport DDR3-1600 -
    Netzteil: Be quiet! BN140 System Power 7 (300W) - 1x 120GB Samsung 850 Evo (System) - 2x 4TB WD Red (Data) - 1x 2TB Seagate Green (Data) - OMV: latest 2.x


    Plugins:
    Plex Media Server, RSync, JDownloader, ownCloud, eXtplorer, antivirus, autoshutdown

    • Offizieller Beitrag

    How can I then schedule the rsnapshot plugin to perform a backup a day with the scheduled tasks?


    In scheduled tasks, the hourly, daily, weekly, monthly, and yearly settings are all anacron. So, you would pick daily and use the same command that cron does: /var/lib/openmediavault/cron.d/rsnapshot daily The only issue I can think of that could possibly happen is that the rsnapshot daily command would execute twice if your server was on at 3:30 am.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • So, you would pick daily and use the same command that cron does: /var/lib/openmediavault/cron.d/rsnapshot daily The only issue I can think of that could possibly happen is that the rsnapshot daily command would execute twice if your server was on at 3:30 am.


    well it is actually not that easy to read what is the exact command the cronjob does because it is quite some code in that file. Actually in cron.d is only a file named rsnapshot with a bit of code in it. I am unsure which would be the command i would need to copy.


    secondly: Well lets see maybe it is possible to not activate rsnapshot over the addon-webinteraface at all or put it to 0 or sth like that, sothat it wouldnt backup twice a day.


    I actually wonder that this question is not yet completely solved somewhere since it should be sth alot of people with WOL-Servers should be looking for. Also I dont understand why the plugin does not offer anacron. It would be extremly handy.


    So I guess figuring that out here would help some people too.


    Thanks alot in advance!

    • Offizieller Beitrag

    Why do you need to figure out the command? I just posted it for you. What am I missing?


    In my opinion, rnsapshot does not need anacron because it is meant to run often - hourly and daily - on servers running all the time. If you want to schedule it less often, just have a few rsync jobs that run

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Offizieller Beitrag

    Yearly runs at 0200
    Monthly runs at 0230
    Weekly runs at 0300
    Daily runs at 0330
    Hourly runs at xx05


    If your NAS doesn't run overnight, I would edit /etc/cron.d/openmediavault-rsnapshot. The first column is the minute column and the second column is the hour.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Offizieller Beitrag

    Yep.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Sounds good, I'll try that - thanks! Is it possible to add GUI settings for these times in the rsnapshot plugin? I think that would be quite helpful.


    Even though it would still be way better if rsnapshot could just be ran on the next system start if the system wasn't running at the scheduled time...

    • Offizieller Beitrag

    It probably could be added or converted to scheduled jobs. I don't have much time and that would be pretty low on my list since not many ask for it.


    Scheduled jobs would allow for that since it can use anacron. The problem with that is most people don't want the snapshot happening while they are using the system.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Hi there,


    from this thread, I understand that rsnapshot is setting specific times for scheduling sync-jobs using cron. This leads to backup-jobs not being run if the server is down at the specified time. Therefore, in order to use anacron instead, I'd like to create 3 scheduled tasks running:


    /var/lib/openmediavault/cron.d/rsnapshot daily
    /var/lib/openmediavault/cron.d/rsnapshot weekly
    /var/lib/openmediavault/cron.d/rsnapshot monthly


    But as you've said, this could lead to sync-jobs being run twice if the server is actually up at one of the specified rsnapshot sync-times.
    So, is it possible to comment the entries in /etc/cron.d/openmediavault-rsnapshot in order to prevent the rsnapshot-scheduler (cron) interfering with the manually set up daily/weekly/monthly scheduled tasks (anacron)?


    edit: And how can I make sure, that the scheduled tasks (daily/weekly/monthly) are run sequently and not all at once?


    Thanks.

    • Offizieller Beitrag

    The whole idea of the rsnapshot plugin is to be running all the time. The I see it is you have two options:


    1 - Make you system wake up at the rsnapshot times.
    2 - Change the times that rsnapshot runs to times when the system is on.


    If you don't want to do one of these, you probably should use rsync.


    But to answer your question, yes you could create scheduled tasks with those commands. Comment out the entries in cron.d. You will just have to fix it anytime there is a plugin update.


    I don't know the answer to the sequential problem. Why would it matter? They are being sync'd to a different directory.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • In scheduled tasks, the hourly, daily, weekly, monthly, and yearly settings are all anacron. So, you would pick daily and use the same command that cron does: /var/lib/openmediavault/cron.d/rsnapshot daily The only issue I can think of that could possibly happen is that the rsnapshot daily command would execute twice if your server was on at 3:30 am.


    Hi,


    this is exatly what I wanted to achieve with the scheduled tasks an I have defined them as you said. For testing purposes I turned off all jobs in cron.d and let the NAS run over night. The daily job of the scheduled tasks was performed at 00:00. The other day the NAS was powered off over the night and when I started it the daily job did not start. The NAS did run several hours but nothing happened.


    Did I not understand it correctly? I thought that it will be checked, if the job has already been done that day and if not, that the job will start. Probably after a specified time. Are there any additional settings to define and where can I find them?

    • Offizieller Beitrag

    Did you turn off the anacron job in cron.d?? Anacron is actually started by cron.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Hi,


    I changed /etc/cron.d/openmediavault-rsnapshot to

    Code
    # m h           dom mon dow user  command
    5 *         * * *           root    /var/lib/openmediavault/cron.d/rsnapshot hourly
    00 0        * * *           root    /var/lib/openmediavault/cron.d/rsnapshot daily
    30 23       * * 1           root    /var/lib/openmediavault/cron.d/rsnapshot weekly
    00 23       1 * *           root    /var/lib/openmediavault/cron.d/rsnapshot monthly
    00 22       1 1 *           root    /var/lib/openmediavault/cron.d/rsnapshot yearly

    So basically the jobs are now scheduled to run 3:30 h earlier than omv standard.


    Comment out the entries in cron.d. You will just have to fix it anytime there is a plugin update.

    Do I understand you correctly: If rsnapshot is updated, the file which I mentioned above will be replaced and the standard omv schedules are restored? So I need to edit this file after every update of rsnapshot?


    After changing the file, I reboot my NAS to make sure the changes are applied. I guess there is some sort of script I could run instead (to avoid rebooting)?


    Best,
    Aiakos

    • Offizieller Beitrag

    Yes, it will overwrite it but there aren't updates very often. When I get some time, maybe I will look into adding times that the cron jobs run.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!