I'm in the trying to learn a bit more about launchd and how I can use it to automate some tasks. For some reason when my very simple example job runs it exits with status code 126. I have changed permissions on all of my files to ensure I wasn't the issue (as 126 codes usually have something to do with permissions), but the issue persists.
/Library/LaunchDaemons/test.plst
<?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>test.monday</string>
<key>Program</key>
<string>/Users/philliptroutman/Desktop/test.sh</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>20</integer>
</dict>
</plist>
/Users/philliptroutman/Desktop/test.sh
#! /bin/sh
echo 'some data' >> /Users/philliptroutman/Desktop/examplefile.txt
echo "some random echo!"
After I load and unload the plst file this is what I get
launchctl unload /Library/LaunchDaemons/test.plist
launchctl load /Library/LaunchDaemons/test.plist
launchctl list | grep test.monday
- 126 test.monday
I guess my question is very simple... why isn't this working?