Scheduled rsync job only works manually

  • Hello!


    I have scheduled an rsync backup of a webserver via the "Scheduled Jobs" tab like this:


    sudo rsync -caAXz --exclude={"/home/someuser/","thumbnails/","cache/","Cache/","tmp/"} backupuser@domain.net:/{opt,etc,home,var} /media/.../backup/ 2>/media/.../rsynclog.txt


    This command works as suspected via terminal, but as a scheduled task I get the following error:
    rsync: link_stat "/{opt,etc,home,var}" failed: No such file or directory


    Strangely, the task works when started manually with the 'Run'-button, but fails each time when scheduled ?(


    Any suggestions?

    • Offizieller Beitrag

    Single : after address means your calling remote transport shell (ssh probably) the webui does not support (yet) that rsync type. You need to use on the origin device and rsync server.
    You can use scheduled task to use that line, but you'll need also to have the source server to use ssh with PKA (no passphrase) because ill be a non interactive shell

  • Thank you very much for your prompt answer!


    When I understand you correctly it is not possible to use rsync via ssh with PSA through the rsync webgui. I have tried that and can confirm that it does not work ;)


    This is why I set it up under System>Scheduled Jobs. There it works correctly if I trigger the job manually (by clicking 'Run'), but at scheduled times I only get the error message above. Do you have an idea why this could be?


  • I got the error in the log. I tried removing the log redirect pipe now and got the same error through email notification. I also tried changing the user to 'root', that gave me the same error aswell.


    PKA is allowed, the keys are stored in /root/.ssh and ~/.ssh for the backup user. I know that the connection is configured porperly because the backup works fine when I use the command as the same user via CLI or trigger the job manually in the Scheduled Jobs tab - if there were a fault, that shouldn't work aswell, or am I mistaken?


    I just can't get my head aroud what could go wrong when the job gets triggered automatically.

  • TIl that crontab does not like complex commands/special characters. Running a scheduled job manually is not done via crontab, that's why it works then.


    Solution: Wrapped the command it in a shell script and called that with the scheduled jobs webgui. Works like a charm.



    Thank you for your answers, subzero79!

  • I don't think Openmediavault did anything wrong here. Adding the command to the users crontab via crontab -e gave the same error. This suggests that crontab uses sh shell instead of bash which does not support {} brackets.

    • Offizieller Beitrag

    No that I recall I encounter the same problem using busy box the other day in a docker container and the curly braces. You have to wrap it like you did, you can try and use a directory containing all the dirs with symlink. I do that to create sort of like a backup sink folder for the usbbackup plugin.
    with the appropiate switch rsync can follow symlinks.

  • Thank you for clarifying. It seems like sticking to the shell script is the better option, then. I currently have no write access to the server, so I can't create symlinks. It is a neat idea though, maybe I will use it in another scenario.

Jetzt mitmachen!

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