I’ve written a shell script that I’d like launchd to periodically run. I’ve created the plist file for /Library/LaunchDaemons/ and loaded it with launchctl, and everything works just like it should except for one part.
Basically, the script does a du on user homes and then is supposed to send me an email that contains a list of offending user homes and their disk usage.
The bash script I’ve written works perfectly when run from terminal as my admin user, however when it’s launched via launchd, the body of the message is never attached and I simply get a blank message.
/usr/bin/mail -s “Disk Usage $userType $serverHost” $fromAddress < /tmp/duPass2
duPass2 is being created and is readable to the script, and if I run the script as my admin user it goes off without a hitch, the only time there is a problem is when it's launched with launchd in which case I get an empty email.
Am I missing something obvious?