[launchd-dev] Technical Question

Jan Michael jan.michael at gmail.com
Tue Sep 16 13:05:20 PDT 2008


Dear Readers,

I'm trying to get the following command launched by launchd on system  
startup

 > while `sleep 4`; do echo **clunk** > /tmp/declunk && rm -f /tmp/ 
declunk; done &

I created a bash script /usr/bin/declunk with

   1 #!/bin/bash
   2 while `sleep 4`; do echo **clunk** > /tmp/declunk && rm -f /tmp/ 
declunk; done &

And than create the following launchd plist in /Library/LaunchDaemons

   1 <?xml version="1.0" encoding="UTF-8"?>
   2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd 
">
   3 <plist version="1.0">
   4 <dict>
   5         <key>Disabled</key>
   6         <false/>
   7         <key>KeepAlive</key>
   8         <false/>
   9         <key>Label</key>
  10         <string>de.tiggar.declunk</string>
  11         <key>ProgramArguments</key>
  12         <array>
  13                 <string>/usr/bin/declunk</string>
  14         </array>
  15         <key>RunAtLoad</key>
  16         <true/>
  17         <key>StartOnMount</key>
  18         <false/>
  19 </dict>
  20 </plist>

Next i try to load the agent with:

 > Sep 16 22:03:00 iah sudo[7855]:      Jan : TTY=ttys000 ; PWD=/ 
Library/LaunchDaemons ; USER=root ; COMMAND=/bin/launchctl load -w  
de.tiggar.declunk.plist
 > Sep 16 22:03:00 iah com.apple.launchd[1] (de.tiggar.declunk[7861]):  
Stray process with PGID equal to this dead job: PID 7863 PPID 7862 sleep
 > Sep 16 22:03:00 iah com.apple.launchd[1] (de.tiggar.declunk[7861]):  
Stray process with PGID equal to this dead job: PID 7862 PPID 1 bash

So the question is now. It is possible to have a script like that work  
with launchd? What do I have done wrong?

Thanks for your help.

Cheers,

	Jan


More information about the launchd-dev mailing list