Hello, I used Lingon for Leopard Server to create a launchd job that would execute the following rsync (v3.0.4) command when logged in as admin at 12:01 AM each day. sudo rsync -aAHvWX /Volumes/File_Storage/docs/ /Volumes/File_Storage_Mirror/docs When launchd executed this command, it did not work. The system.log file reads "Exited with exit code: 1". It called it at 12:01 AM, but it did not execute properly. When I VNC via SSH into the server, and execute that exact same command at the Terminal manually, it works as expected. If anyone can offer any insight as to what to check so that this command will execute successfully when called by launchd, I would appreciate it. My first thought is to modify the command to include the rsync path. sudo rsync -aAHvWX --rsync-path=/usr/local/bin/rsync /Volumes/File_Storage/docs/ /Volumes/File_Storage_Mirror/docs Thanks for reading! Jonathan S. Abrams Apple Certified Support Professional (v10.5)
My first guess -- superficial because I am in a hurry right now but nevertheless want to help a little -- is that it is a permission problem: Your command line starts with a "sudo", and I am not sure how "launchd" gets sudo permissions without user interaction. Regards, Stefan Nowak Am 13.12.2009 um 17:49 schrieb Jonathan S. Abrams:> Hello, > > I used Lingon for Leopard Server to create a launchd job that would > execute the following rsync (v3.0.4) command when logged in as admin > at 12:01 AM each day. > > sudo rsync -aAHvWX /Volumes/File_Storage/docs/ /Volumes/ > File_Storage_Mirror/docs > > When launchd executed this command, it did not work. The system.log > file reads "Exited with exit code: 1". It called it at 12:01 AM, > but it did not execute properly. > > When I VNC via SSH into the server, and execute that exact same > command at the Terminal manually, it works as expected. If anyone > can offer any insight as to what to check so that this command will > execute successfully when called by launchd, I would appreciate it. > > My first thought is to modify the command to include the rsync > path. sudo rsync -aAHvWX --rsync-path=/usr/local/bin/rsync /Volumes/ > File_Storage/docs/ /Volumes/File_Storage_Mirror/docs > > Thanks for reading! > > Jonathan S. Abrams > Apple Certified Support Professional (v10.5)
On Sun, Dec 13, 2009 at 8:49 AM, Jonathan S. Abrams <hociman at comcast.net>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 ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20091213/96a00161/attachment.html>
Wayne Davison wrote:> On Sun, Dec 13, 2009 at 8:49 AM, Jonathan S. Abrams > <hociman at comcast.net <mailto:hociman at comcast.net>> 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 > > ..wayne..Wayne, Thanks for responding. Would it be enough to instruct rsync to log activity to a file? sudo rsync -aAHvWX --log-file=docs_transfer /Volumes/File_Storage/docs/ /Volumes/File_Storage_Mirror/docs -Jonathan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20091213/0e3beb9f/attachment.html>
> 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 requirettyI 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. --------------------------------------------------------------------- This email is protected by LBackup, an open source backup solution. Free as in freedom; LBackup is licensed under the GNU GPL Download LBackup now : http://www.lbackup.org ---------------------------------------------------------------------