Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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

Posted on Feb 5, 2014 7:09 AM

Reply
16 replies

Simple Script and Launchd error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.