[launchd-dev] Why no key to "Run once on restart"
Thomas Clement
tclementdev at gmail.com
Tue May 24 01:01:07 PDT 2011
You should probably use "RunAtLoad" instead of "StartOnMount".
Thomas
On 24 mai 2011, at 00:15, Jerry Krinock wrote:
> It seems that a fairly popular trigger would be a job that runs once, when the computer is restarted or user logs in. But I don't see a key for this in launch.plist(5).
>
> To get that effect, I'm using the two keys StartOnMount + LaunchOnlyOnce. The former does the job because a filesystem must be mounted when a computer restarts, and the latter keeps it from starting multiple times in case another filesystem is mounted before it exits. This works, but is indirect and kludgey.
>
> Is there a better way to do this?
>
> The reason I want to do this is to restart a syncing task which may take a minute or so and thus could be interrupted by system shutdown. When my task begins, it loads this new "standby" StartOnMount+LaunchOnlyOnce agent to re-run the same task when the system starts up. But when my task ends normally, it unloads this agent. Therefore it only ever spawns if my task was interrupted.
>
> Thank you,
>
> Jerry Krinock
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
More information about the launchd-dev
mailing list