Use Launchd to run shell script at boot
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hello
I'm trying to create a plist file that will run a shell script at bootup of the server.
I have the following xml so far in the plist file:
<?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>Disabled</key>
<false/>
<key>Label</key>
<string>com.apple.mymount</string>
<key>ProgramArguments</key>
<array>
<string>/mount-script/./mount.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
The shell script is just a mount command:
#!bin/sh
#MOUNT folder X ON server Y
sudo -u _www mount_smbfs -f 777 -d 777 //username:password@server/folder /mnt/mount
The shell script works fine from the terminal.
I can see the plist has loaded after bootup but the script doesn't run.
What am I doing wrong?
Would need some help please!
7 replies
Sign in or join Beachball Help to reply.
- 0
- 0
- 0
- 0
- 0
- 0
- 0