I have a bash script that I would like to run with a launchd plist file on OS X. The problem I have is is that the bash script contains sudo commands and it is stopping it from running. So for example my bash script looks like this:
#!/bin/bash
sudo /opt/local/bin/bindfs -u user1 /Library/WebServer/Documents/user1 /vhosts/user1/public_html
sudo /opt/local/bin/bindfs -u user2 /Library/WebServer/Documents/user2 /vhosts/user2/public_html
and my com.test.bindfs.plist file looks like this (created with Lingon):
<?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>GroupName</key>
<string>admin</string>
<key>Label</key>
<string>com.jamespayne.bindfs</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/bindfs.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I have checked to see that the script works by running it after startup and entering a password but it wont run at startup. The launchd plist is running but it comes up with the following error:
sudo: no tty present and no askpass program specified
Anybody know how to get this working or why I might get that error. Thanks.