I can’t get the launch daemon to run the shell script

launchdplistscript

For some reason, I am unable to get my shell script to run when the computer boots. My script fine by itself, but for some reason my Launch Daemon is not starting the job. Please help.

My launch daemon is saved in /Library/LaunchDaemons/local.pingtest.plist

My Launch Daemon Plist:
enter image description here

<?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>local.pingtest</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/sh</string>
        <string>/pingtest/pingtest.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

my shell script:
enter image description here

/usr/bin/nohup /sbin/ping -i 5 ipaddress | /usr/bin/xargs -L 1 -I '{}' date '+%Y-%m-%d %H:%M:%S: {}' >> /pingtest/Ryan-lou.txt &

/usr/bin/nohup /sbin/ping -i 5 www.google.com | /usr/bin/xargs -L 1 -I '{}' date '+%Y-%m-%d %H:%M:%S: {}' >> /pingtest/Ryan-int.txt &

/usr/bin/nohup /sbin/ping -i 5 ipaddress | /usr/bin/xargs -L 1 -I '{}' date '+%Y-%m-%d %H:%M:%S: {}' >> /pingtest/Ryan-fcc.txt &

Best Answer

First I'd check the path of pingtest.sh relative to how it's defined in local.pingtest.plist.

I've not played around with the launch daemon on Macs yet but there may be some special need for it to be in /System/Library/LaunchDaemons instead. Not sure why it'd end up ignoring the other location by the time you're logged in and looking at it but I've seen specifications ignored before on systems so worth a try.

Next I'd check for things like conflicting Label identifiers and that my other keys mean what I think they mean.

Doesn't look like your script is dependent on non-launchd daemons, but those are things to keep in mind.