henri wrote:
When launchd executed this command, it did not work. The system.log file reads
"Exited with exit code: 1".
Can you redirect the output to a file so it can tell you why it failed? e.g.
>file.out 2>&1
One common thing that prevents non-interactive sudo is this tty setting:
Defaults requiretty
I agree, it is very likely that sudo is asking for a password and this may be causing the "Exited with exit code:1" error message.
On possible alternative is to issue the rsync command directly as root.
This approach may not be suitable or even required in your setup. It will
probably depend upon the owners and permissions of the files located within the
/Volumes/File_Storage/docs/ directory on your system.
I would also suggest that you consider using the absolute path to the rsync
command when it is run via LaunchD. Three common possibilities are listed below
:
/opt/local/bin/rsync
/usr/local/bin/rsync_v3.0.6
/usr/bin/rsync
To find the absolute path to the version you are running, login to a shell on the server and issue the command below. You should find that the absolute path to the first rsync command in your search path will be returned :
which rsync
The reason I suggest specifying an absolute path is because, when you login to
a terminal, it is very common that a search path has been set. This search path
will be used to locate many commands, such as rsync on your system. The search
path provides a places to search and also order if more than one command exists
with the same name. It is possible to have more than one command with the same
name installed on a system. The search path set in the terminal may be
different to the search path set when the command is executed from LaunchD. As
such this is quite important.
To determine your path issue the following command :
echo $PATH
It is quite likely that the search path returned is different when you are
logged in to a terminal session differs from the search path provided when
commands are started from LaunchD or cron.
More details are available from : http://en.wikipedia.org/wiki/PATH_(variable)
Hopefully this information is helpful and you will have your script working
soon.
To close this thread, executing the command as sudo solved the problem.
The command I'm using is
sudo /usr/local/bin/rsync -aAHvx <source> <destination>
Thanks for the tips!
-Jonathan
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html