[launchd-dev] A question about launchd and cron

wierzbowski wierzbowski at gmail.com
Sat Mar 6 13:49:21 PST 2010


> Date: Fri, 5 Mar 2010 23:04:47 +0000
> From: Quinn <eskimo1 at apple.com>
> To: launchd-dev at lists.macosforge.org
> Subject: Re: [launchd-dev] A question about launchd and cron
> Message-ID: <p06240832c7b73e8627e1@[10.0.40.15]>
> Content-Type: text/plain; charset="us-ascii" ; format="flowed"
> 
> At 14:34 -0800 5/3/10, wierzbowski wrote:
>
>> Please let me know if this would be an appropriate subject for this list.
> 
> Sure.  Fire away!
> 
> S+E

For demonstration purposes I've set up a simple crontab and cronjob running
as myself (i.e. non-root).

Here is the crontab:

SHELL="/bin/sh"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
HOME="/Users/wierzbowski"
MAILTO="wierzbowski at somewhere"
* * * * * /Users/wierzbowski/bin/helloworld

Here is the content of /Users/wierzbowski/bin/helloworld:

#!/bin/sh
/bin/echo "hello world."
exit 0

Here is the output when I run the script manually:

hello world.

Here is the output that is mailed to me when the script runs via cron:

hello world.

Here is the error recorded in the syslog:

Mar  5 12:17:00 macbookpro com.apple.launchd[1] (0x10e4d0.cron[97753]):
Could not setup Mach task special port 9: (os/kern) no access

Basically, on all the systems I manage I get that "special port 9" error in
the syslog every time cron executes a job. And it doesn't seem to matter if
it's a root or non-root job, if I have the environment explicit defined or
not, if the cronjob is a one-liner right in the crontab or if it calls
another shell script, if the script generates output or not, if the script
redirects any i/o or not, if the script writes any files or not, etc.

I'm just trying to figure out if there's a fundamental flaw in my cron usage
on OS X, or if I've hit a bug and I just have to accept a few thousand extra
lines in the syslog every day. I also realize that cron has been deprecated
in favor or straight up launchd, and I'll get around to converting one of
these day I swear, but for the moment I don't have the luxury of bumping
that project to the top of my stack. :)

I did take a quick look at the launchd source code, and I see where the
error message is coming from, but I'm definitely no programmerologist and I
have no idea what triggers that particular bit of code.

Thanks in advance for any insight.

Wierzbowski




More information about the launchd-dev mailing list