[launchd-dev] fork & exit in Shell Script

Charles Darwin DarwinsKernel at gmail.com
Wed Oct 29 10:36:05 PDT 2008


Hi all,

I have a shell script that runs RunAtLoad. Here is the script:

########
/bin/test -f /Volumes/tutorials || /bin/mkdir -p /Volumes/tutorials  
&& /sbin/mount_afp afp://username:password@url/tutorials/ /Volumes/ 
tutorials/


/bin/test -f /Volumes/homes || /bin/mkdir -p /Volumes/homes && /sbin/ 
mount_afp afp://username:password@url/homes/ /Volumes/homes/
########
and here is the plist:

------------------
<?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>label</string>
         <key>ProgramArguments</key>
         <array>
                 <string>path/to/script</string>
         </array>
         <key>StartCalendarInterval</key>
         <dict>
                 <key>RunAtLoad</key>
                 <true/>
         </dict>
</dict>
</plist>
------------------
It takes almost a minute after my users login to see the afp  
sharepoint mounted. Here is the log from syslog:

------------------
Oct 29 11:49:31 … loginwindow[240] <Error>: Login Window Started  
Security Agent
Oct 29 11:49:31 … SecurityAgent[248] <Error>: Showing Login Window
Oct 29 11:51:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:51:00 … launchd[204] <Warning>: <label>: 9 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:52:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:52:00 … launchd[204] <Warning>: <label>: 8 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:53:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:53:00 … launchd[204] <Warning>: <label>: 7 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:54:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:54:00 … launchd[204] <Warning>: <label>: 6 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:55:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:55:00 … launchd[204] <Warning>: <label>: 5 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:56:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:56:00 … launchd[204] <Warning>: <label>: 4 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:57:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:57:00 … launchd[204] <Warning>: <label>: 3 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:58:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:58:00 … launchd[204] <Warning>: <label>: 2 more failures  
without living at least 60 seconds will cause job removal
Oct 29 11:59:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 11:59:00 … launchd[204] <Warning>: <label>: 1 more failure  
without living at least 60 seconds will cause job removal
Oct 29 12:00:00 … launchd[204] <Warning>: <label>: exited with exit  
code: 58
Oct 29 12:00:00 … launchd[204] <Warning>: <label>: too many failures  
in succession
------------------

Does this have anything to do with "your daemon must not daemonize  
itself (fork and exit)"? (whatever that means) Any idea how I can fix  
it?

Thanks,
Charles 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20081029/d1398ac3/attachment.html>


More information about the launchd-dev mailing list