You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

launchd and periodic: mail does not get sent

Hello together,

I have the same problem as reported in this thread:
http://discussions.apple.com/thread.jspa?messageID=6241179
According to the thread the problem seemed to be fixed in Mac OS X 10.5.2 but I have it in 10.5.5

In short:
Whenever periodic scripts are started by launchd they run but no email is sent even if there is a file /etc/periodic.conf set up to send email.
Instead an entry appears in /var/log/system .log:
com.apple.launchd[1] (com.apple.periodic-daily[307]): Stray process with PGID equal to this dead job: PID 363 PPID 1 sendmail
If the periodic jobs are started in terminal with "sudo periodic daily" the mail is sent by the local mail system.

Does anyone know, how to fix this.

Thanks in advance
Martin

iMac 20'' (Intel), G4 Sawtooth, iBook G4 800, Mac OS X (10.5.5)

Posted on Oct 8, 2008 12:08 PM

Reply
4 replies

Nov 23, 2008 8:36 AM in response to macmartin

Here is what happened to me:
I don't seem to be able to send mail from the periodic system
tasks that run daily or weekly when managed by launchd.

Due to OS corruption I had to do a clean install. In the previous
incarnation of the OS I used anacron and did not have a problem
with generating the email messages.

I can also execute /usr/sbin/periodic daily directly as root and
the email will be generated.

Contents of daily.local:
********************
bash-3.2# cat /etc/daily.local
#!/bin/sh
# sync wiki data with server
/usr/local/bin/pullFromServer

export HOME=/var/root
/usr/bin/printenv
/usr/bin/mail -s "Daily Cron Job" jerry <<DOC
Daily Cron ran on `/bin/date`
DOC
********************
Tail of daily.out
********************
Running daily.local:
receiving file list ... done

sent 76 bytes received 4245 bytes 8642.00 bytes/sec
total size is 712305 speedup is 164.85
host=mbp
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PWD=/var/spool/fax
HOME=/var/root
SHLVL=3
_=/usr/bin/printenv

-- End of daily output --
************************

The system log contains these complaints when the periodic
tasks are run.

bash-3.2# cat system.log | grep apple.periodic
Nov 21 03:16:47 mbp com.apple.launchd[1] (com.apple.periodic-daily[1904]): Stray process with PGID equal to this dead job: PID 1969 PPID 1 sendmail
Nov 22 08:10:08 mbp com.apple.launchd[1] (com.apple.periodic-daily[2286]): Stray process with PGID equal to this dead job: PID 2379 PPID 1 sendmail
Nov 22 08:22:39 mbp com.apple.launchd[1] (com.apple.periodic-weekly[2287]): Stray process with PGID equal to this dead job: PID 2465 PPID 1 sendmail
Nov 23 08:21:33 mbp com.apple.launchd[1] (com.apple.periodic-daily[5588]): Stray process with PGID equal to this dead job: PID 5660 PPID 5656 postdrop
Nov 23 08:21:33 mbp com.apple.launchd[1] (com.apple.periodic-daily[5588]): Stray process with PGID equal to this dead job: PID 5656 PPID 1 sendmail

**************************

There are no entries in the mail log file at the time the periodic tasks are run.

Any suggestions on how to fix the problem?

Jerry

Feb 20, 2009 8:59 AM in response to Jerry Levan1

Jerry Levan1 wrote:
Any suggestions on how to fix the problem?

Jerry


The problem:

launchd is killing the mail process before it can send the email because it considers it a stray child process.

That is what this line is telling you:

"Nov 21 03:16:47 mbp com.apple.launchd[1] (com.apple.periodic-daily1904): Stray process with PGID equal to this dead job: PID 1969 PPID 1 sendmail"

The solution:

I added the following to my com.apple.periodic-daily.plist and the daily run output started being mailed to me again...

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

Like so:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.
com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.apple.periodic-daily</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/periodic</string>
<string>daily</string>
</array>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>1</integer>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>15</integer>
</dict>
<key>AbandonProcessGroup</key>
<true/>
</dict>
</plist>


Make sure you unload and load com.apple.periodic-daily.plist after you make the change so it is seen by launchd...

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.periodic-daily.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.periodic-daily.plist

Further details at:

http://developer.apple.com/technotes/tn2005/tn2083.html#SECCAREFULWITHTHATFORKEU GENE

Cheers,

Darrell

launchd and periodic: mail does not get sent

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.