Simple Script and Launchd error
Hi, I 'm just trying to run a simple script tu restart afp services over night, I have try so much things but my script just refuse to run, got error 127 and now just dont know what to do next to make it work. Thanks for your help.
My script Location: /script/afprestrat.sh
sudo chmod a+x /script/afprestrat.sh
The script:
#!/bin/bash
serveradmin stop afp
sleep 2
serveradmin start afp
PLIST location :
/Library/LaunchDaemons/com.compagny.afprestart.plist
the Plist:
<?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.compagny.afprestart</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>/script/afprestart.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/Users/admin/Documents/script/afprestart_err.log</string>
<key>StandardOutPath</key>
<string>/Users/admin/Documents/script/afprestart.log</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>4</integer>
<key>Minute</key>
<integer>05</integer>
</dict>
</dict>
</plist>
Command:
sudo launchctl load -w /Library/LaunchDaemons/com.compagny.afprestart.plist
Console error:
com.apple.launchd com.compagny.afprestart Exited with code:127
and afp service wasnt restart.
Any hint will be really apprciated.
thx !!!
Mac OS X (10.7.5), windows 2008 sr2