0

I have a custom made service file and I'm unable to run it. Here is the ExecStart line:

ExecStart=/bin/rsync --ignore-existing -rtvu /var/foo/foo/ /var/foo2/foo2 && /bin/chown nginx:nginx -R /var/foo2/foo2/ && /bin/chmod -R 777 /var/foo2/foo2/

Whenever I try to run the service, I get the following error message in the log files:

Sep 26 10:27:21 myserver rsync[9609]: Unexpected remote arg: nginx:nginx
Sep 26 10:27:21 myserver rsync[9609]: rsync error: syntax or usage error (code 1) at main.c(1214) [sender=3.0.9]

Any ideas what is the issue? The commands are running fine when I copy-paste them to my terminal

3

ExecStart is not a shell. See the 'Command Lines' section in the documentation https://www.freedesktop.org/software/systemd/man/systemd.service.html.

You need to run a shell with your command line as it's argument.

  • Thank you! The solution will be then: ExecStart=/bin/rsync --ignore-existing -rtvu /var/foo/foo/ /var/foo2/foo2 ; /bin/chown nginx:nginx -R /var/foo2/foo2/ ; /bin/chmod -R 777 /var/foo2/foo2/ and also it should be oneshot type. – Bert Sep 26 '18 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.