Rsnapshot - script for monthly cron job on specific day is not working - anyone has a hint?

    • OMV 3.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Rsnapshot - script for monthly cron job on specific day is not working - anyone has a hint?

      Hi,

      I wanted to implement a script which runs a rsnapshot monthly backup every first saturday of the month... but it doesn´t work.

      cron for openmediavault-rsnapshot:

      5 * * * * root /var/lib/openmediavault/cron.d/rsnapshot hourly
      5 14 * * * root /var/lib/openmediavault/cron.d/rsnapshot daily
      30 0 * * 4 root /var/lib/openmediavault/cron.d/rsnapshot weekly
      05 14 19-25 * * root /etc/cron.d/monatlich.sh
      00 5 1-7 1 * root /etc/cron.d/jaehrlich.sh


      monatlich.sh:

      #!/bin/bash
      wochentag=`date +%u`
      echo "$wochentag"

      if [ "$wochentag" = "4" ]
      then
      /var/lib/openmediavault/cron.d/rsnapshot monthly
      fi


      I thought the script runs today: 4 is Thursday (today); 20th is a Thursday , why doesnt it run at 15:00?
      Thx for the support!!! 8o

      The post was edited 3 times, last by foly12 ().

    • I checked now the rsnapshot script, and it looks strange to me (with very little programming experience), that there is no "monthly" or "yearly" line

      #!/bin/bash
      if [ -z "$1" ]; then
      echo "No argument given. Should be one of: hourly,daily,weekly,monthly,yearly. UUID of backup job can be passed as second argument to execute a single job."
      exit 1
      fi
      mail=false
      # backup /media/9c6b7cd0-8fd6-4938-9928-597350708044// to /media/cd9a2063-ab1e-403b-8b9c-129c19072080/QNAP_Backup/
      skip=false
      if [ "$1" = "hourly" ]; then skip=true; fi
      if [ "$1" = "daily" ]; then skip=true; fi
      if [ "$2" = "c4a16271-b560-449c-9b8f-2a3faa742633" ] || ([ -z "$2" ] && [ $skip = false ]); then
      targetdir="/media/cd9a2063-ab1e-403b-8b9c-129c19072080/QNAP_Backup//media/9c6b7cd0-8fd6-4938-9928-597350708044//"
      if [ ! -e "${targetdir}" ]; then
      mkdir -p "${targetdir}"
      fi
      while [ -n "${targetdir}" ] && [ "${targetdir}" != "/media/cd9a2063-ab1e-403b-8b9c-129c19072080/QNAP_Backup/" ]; do
      chmod 2775 "${targetdir}"
      chgrp users "${targetdir}"
      targetdir="${targetdir%/*}"
      done
      /usr/bin/rsnapshot -c "/var/lib/openmediavault/rsnapshot.d/rsnapshot-c4a16271-b560-449c-9b8f-2a3faa742633.conf" "$1"
      fi
    • If your number of monthly snapshots is set to 0, you won't see a line. This is number it keeps.
      omv 4.1.9 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.9
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • That is a default file added by the rsnapshot package. You can't use one file for multiple jobs. Look in /var/lib/openmediavault/rsnapshot.d
      omv 4.1.9 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.9
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • I already checked this rsnapshot.d script, but I can not find an error there, or reason why monthly is not startet ...

      # rsnapshot-c4a16271-b560-449c-9b8f-2a3faa742633.conf
      # This configuration file is auto-generated.
      # WARNING: Do not edit this file, your changes will be lost.
      config_version 1.2
      snapshot_root /media/cd9a2063-ab1e-403b-8b9c-129c19072080/QNAP_Backup//media/9c6b7cd0-8fd6-4938-9928-597350708044///
      no_create_root 1 # target root will be created before rsnapshot is running
      retain weekly 4
      retain monthly 4
      retain yearly 3
      verbose 2
      loglevel 2
      cmd_cp /bin/cp
      cmd_rm /bin/rm
      cmd_rsync /usr/bin/rsync
      cmd_logger /usr/bin/logger
      logfile /var/log/rsnapshot.log
      rsync_long_args --delete --numeric-ids --delete-excluded
      one_fs 0
      # no extra destination dir

      The post was edited 1 time, last by foly12 ().

    • Why don't you use the plugin instead of manually editing things? Just set everything except the monthly to zero.
      omv 4.1.9 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.9
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • Because I want to have the backups done always onsaturday, as the qnap is always running on weekends and only sometimes during the week.

      The weekly snapshot i can set to "6" saturday, but for the monthly and yearly this is not possible, so i thought my little monatlich.sh shell will do it like this. Di you see the error in the files?
      Thx!!!
    • If you don't want to use the plugin the way it was designed, I would uninstall it and configure rsnapshot manually. The plugin itself is probably causing the issues.
      omv 4.1.9 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.9
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!