Hi,
I am trying to use launchd to run a shell script backing up my box to an external HD. The script (backupmgr.sh) uses rdiff-backup, and it runs as expected when I launch it from Terminal. This script includes email reporting to email me results of my backup attempt.
I modified an example .plist to run this script at 0330 every day. The .plist is in ~/Library/LaunchAgents, so it will only run when I'm logged in.
My problem is that, although the script runs perfectly from the Terminal, it fails (/Users/mindlab/backup/backup.sh: line 32: rdiff-backup: command not found) when launchd runs it. I cannot figure out why! How could a command be 'not found' from launchd when it works from Terminal?
I've attached the .plist below. Any help would greatly appreciated.
I am trying to use launchd to run a shell script backing up my box to an external HD. The script (backupmgr.sh) uses rdiff-backup, and it runs as expected when I launch it from Terminal. This script includes email reporting to email me results of my backup attempt.
I modified an example .plist to run this script at 0330 every day. The .plist is in ~/Library/LaunchAgents, so it will only run when I'm logged in.
My problem is that, although the script runs perfectly from the Terminal, it fails (/Users/mindlab/backup/backup.sh: line 32: rdiff-backup: command not found) when launchd runs it. I cannot figure out why! How could a command be 'not found' from launchd when it works from Terminal?
I've attached the .plist below. Any help would greatly appreciated.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mindlab.backup</string>
<key>LowPriorityIO</key>
<false/>
<key>Nice</key>
<integer>1</integer>
<key>AbandonProcessGroup</key>
<true/>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/Users/mindlab/backup/backupmgr.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
</dict>
</plist>