Sending mail from launchd jobs

July 12, 2009

In case you’ve ever wondered why your launchd scripts are not sending mail (even though they seem to be running), it’s probably because of a silly incompativiliy between launchd and mail, described in more detail here.

To work around this, always include the following in your job’s plist:

<key>AbandonProcessGroup</key>
<true/>

and then just reload the plist. I find myself doing that quite often, so this Bash alias helps cut down on typing:

alias lcreload="launchctl unload -w $1; launchctl load -w $1"