« Return to Thread: run once and then vaporize

Re: run once and then vaporize

by Quinn-9 :: Rate this Message:

Reply to Author | View in Thread

At 19:15 -0700 23/7/08, Blake Garner wrote:
>My test script currently just echo's some text into system.log and
>exits. The script runs but the launchd item fails to unload or remove
>itself.

That's because launchd does not pass the ProgramArguments to a shell;
rather, it invokes fork/exec (maybe even posix_spawn these days) with
those arguments.  So the ";" isn't considered special.  If you modify
your "runonce.sh" to print all of its arguments, you'll find that
it's getting a whole bunch of extra ones (-:

I don't think this ProgramArguments approach is going to work.  You
will have to unload the job from your script.

Alternatively, don't unload the job.  Once a job is loaded, it
doesn't depend on the plist file, so removing the plist file out from
underneath launchd won't cause you any problems.  The job will
continue to exist in launchd (until the system restarts) but it won't
get run against unless someone specifically invokes it.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
launchd-dev mailing list
launchd-dev@...
http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev

 « Return to Thread: run once and then vaporize