[launchd-dev] fork & exit in Shell Script (Revisited)

Quinn eskimo1 at apple.com
Wed Nov 19 10:25:36 PST 2008


[Whoops, I missed your email from Friday.]

At 16:23 -0500 14/11/08, Charles Darwin wrote:
>>That's probably true, but there are certain advantages to using a 
>>login item, namely that a login item doesn't have to be code: it 
>>can be anything that the Finder can open.  You can solve this 
>>probably with no code by simply creating an alias to the server 
>>volume in question and adding that alias to the login item list.
>
>I have 10 machines here so that is practically impossible to do.

Keep in mind that there's a programmatic API both for creating 
aliases and adding them to the login item list.

>Then what is the purpose of having that (mount_afp utility that is) 
>installed on your system?

The mount tools exist primarily for historical reasons.  On standard 
user systems out in the field, all mounting is handled by higher 
level infrastructure (Disk Arb, URLMount framework, automount).  This 
high-level infrastructure invokes these mount tools, but that's 
really just an implementation detail.  It's perfectly fine to invoke 
the mount tools directly, as long you understand the consequences of 
doing so.  However, if your goal is to have the system act like the 
volume was mounted by the user, it's a good idea to mount the volume 
using the same APIs that get invoked when the user mounts the volume 
(that is, FSMountServerVolumeSync).

>I don't care if it relaunches for that session (which in my script 
>it doesn't by the way) what I can't get launchd to is to relaunch it 
>when user logs out and then logs back without rebooting the system.

I missed this aspect of the problem so, just to be sure, I tested my 
script to ensure that it correctly gets relaunched in the "logout 
then log straight back in" scenario, which it does.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list