openmediavault / openmediavault

openmediavault is the next generation network attached storage (NAS) solution based on Debian Linux. Thanks to the modular design of the framework it can be enhanced via plugins. openmediavault is primarily designed to be used in home environments or small home offices.
https://www.openmediavault.org
Other
5k stars 475 forks source link

rsync cron jobs with multiple source directories & files #1801

Closed gromeck closed 1 month ago

gromeck commented 1 month ago

openmediavault allows to configure rsync jobs which are executed via cron (nice!). rsync allows to pass multiple source directories and files in the form:

user@host:/dir1 :/dir2 :/dir3

rsync will process all given sources in the job -- openmediavault doesn't support this parameter handling, except you use an ugly workaround.

To Reproduce

  1. open the openmediavault workbench
  2. navigate to Services - Rsync - Tasks
  3. Create a new task by pressing (+)
  4. set the following parameters
    • Type=local
    • Mode=pull
    • Source server=root@<yourserver.here>:/etc :/home
    • Destination shared folder=<your local folder>
    • Authentication=Public Key
    • SSH Port=22
    • SSH certificate=<your-ssh-cert>
    • check all further options
  5. Save this new task
  6. Apply pending configuration changes
  7. Select the newly created task
  8. Choose Run
  9. Observe that the following error is reported:
    rsync: [sender] change_dir "/etc :" failed: No such file or directory (2)
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1865) [Receiver=3.2.7]
    rsync: [Receiver] write error: Broken pipe (32)

Expected behavior

The rsync cronjob should process all given source directories and files.

openmediavault Server:

Client:

n/a

Workaround

The problem is located in /openmediavault/deb/openmediavault/srv/salt/omv/deploy/rsync/files/cron-rsync-script.j2, line 77:

{{ separator }}"{{ srcuri }}" "{{ desturi }}" & wait $!

The source is passed in double quotes to rsync which then processes these as one command line argument.

The workaround (see the steps to reproduce above) is to seperate the different arguments for Source server not only with a single blank, but with " ":

Source server=root@<yourserver.here>:/etc" ":/home

This looks weird and ugly -- but works for now.

Additional context

Insertion of a sequence like " " arises the question, if passed parameters are well checked in the workbench -- but this is a different story.

votdev commented 1 month ago

Insertion of a sequence like " " arises the question, if passed parameters are well checked in the workbench -- but this is a different story.

Such complex input fields are not validated because checking this via regex will end in an disaster.