Cron and rsync - not excluding folders

  • Hi,


    I decided to backup my os SD card with OMV in the most simple way with rsync to HDD and then to pack it. For that I am using 2 cron jobs:


    Code
    rsync -aAXv / --exclude={"/dev/*","/export/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/srv/*","/media/*","/lost+found"} /srv/dev-disk-by-id-XXX/backup/raw


    and


    Code
    tar -cvjf /srv/dev-disk-by-id-XXX/backup/backup_$(date +%Y%m%d).tar.bz2 /srv/dev-disk-by-id-XXX/backup/raw


    The 2nd line of code works fine. I have tested rsync line 3 times with different results:
    1st time - Copied what was supposed to copy (excluded not needed folders).
    2nd time - Copied what was supposed to copy + created folders from "excluded" but did not copy their contents.
    3rd time - Copied everything, including folders from "excluded".


    I have been always running the same and only command. Why do I have so different (and incorrect) results? 3rd time resulted in 20 times looped backup before I spotted something is wrong.

  • Ok, but as far as I know cron scripts have "#!/bin/bash" line added at the very beginning. Is OMV also adding it when creating a cron job via the OMV site?

    OMV's System | Scheduled Jobs menu item does not create "cron scripts." It makes one line entries in the crontab of the root account.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

Jetzt mitmachen!

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