[launchd-dev] multiple command lines in launchd.

Damien Sorresso dsorresso at apple.com
Sun Dec 13 15:33:00 PST 2009


On Dec 13, 2009, at 3:25 PM, Scott Haneda wrote:
> On Dec 13, 2009, at 2:46 PM, dev.admin at ntlworld.com wrote:
>> stumbled across a book (in google) that gives you
>> can example of just this. Haven't tried it, but I'm
>> having the same problem with something else.
> 
> What are you getting stuck on specifically? One thing I've never gotten to work, even as a single command, is any form of redirection command. 
> 
> So 'echo "something" >> /tmp/testfile' has never worked at al. I just get an exit code in syslog. 

launchd is not a shell intepreter. ">>" is just another string to it. If you want to redirect a job's stdout, you should use the StandardOutPath plist key. Were your job a typical launchd job (with a shell script on-disk that was executed), this wouldn't be a problem.

> If anyone has specific data on how to best debug these cases, and get more verbosity in the logs, I would love to know how. 

`sudo launchctl log level debug`

Then edit your /etc/syslog.conf file, changing the first line from

> *.notice;authpriv,remoteauth,ftp,install,internal.none	/var/log/system.log

to 

> *.debug;authpriv,remoteauth,ftp,install,internal.none	/var/log/system.log


Then `sudo killall -HUP syslogd`. Note that this will dump a *ton* of stuff into your syslog. 

But in your case, extra logging won't help. There's no bug in launchd here.
-- 
Damien Sorresso
BSD Engineering
Apple Inc.



More information about the launchd-dev mailing list