I have a script monta.sh
to mount an external volume:
#!bin/sh
mkdir -p /Volumes/remvol
mount_smbfs //user:password@server/folder /Volumes/remvol
Then I have a com.jo.monta.plist
to launch the script after system boot placed in /Library/LaunchDaemons
:
<?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.jo.monta</string>
<key>Disabled</key>
<false/>
<key>UserName</key>
<string>admin</string>
<key>ProgramArguments</key>
<array>
<string>/Users/admin/scripts/monta.sh</string>
</array>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I've tested the script from the command line and it works, however if I log in after boot the volume is not mounted.
It seems like the plist file doesn't load? what's wrong?
Best Answer
The script and the plist work perfectly well if you make following changes:
add a slash in /Users/admin/scripts/monta.sh:
proper ownership of com.jo.monta.plist:
proper file mode bits of /Users/admin/scripts/monta.sh:
load the launch daemon: