[launchd-dev] fork & exit in Shell Script

Charles Darwin DarwinsKernel at gmail.com
Wed Oct 29 11:59:22 PDT 2008


On 29-Oct-08, at 2:22 PM, Damien Sorresso wrote:

> On Oct 29, 2008, at 10:36 AM, Charles Darwin wrote:
>> 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>
>
> Firstly, it is convention to use the reverse-DNS scheme for your  
> job label (i.e. com.domain.something). Secondly, RunAtLoad belongs  
> under the root node of the plist, not under StartCalendarInterval.  
> Try restructuring your plist like this...
>
>> <?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>RunAtLoad</key>
>>         <true/>
>> </dict>
>
> -- 
> Damien Sorresso
> BSD Engineering
> Apple Inc.
>

Solved. Thanks Damien.

Charles



More information about the launchd-dev mailing list