Re: Modifying launchd-compliant daemon's plist from within the deamon.
Re: Modifying launchd-compliant daemon's plist from within the deamon.
- Subject: Re: Modifying launchd-compliant daemon's plist from within the deamon.
- From: Dave Zarzycki <email@hidden>
- Date: Tue, 12 Aug 2008 08:16:21 -0700
On Aug 5, 2008, at 10:58 AM, Maxim Zhuravlev wrote:
Hi, Dave.
We'd advise against using the launchd configuration file as a
substitute for
a real configuration file. Please consider just leaving "RunAtLoad"
== true
and then have your program read a configuration file to determine
whether
any action is necessary.
Actually, some questions arise on the way:
1) Are there any launchd-provided or another *out-of-the-box* ways to
distinguish, whether the daemon is launched at boot time or by
WatchPaths paths modification, so that it can decide to proceed with
conditional or unconditional processing respectively?
Maxim,
No. This is intentional. We don't want users to reboot their computers
unless the kernel, drivers or firmware has been updated. To further
this goal, we try hard to hide the fact that the first launch of a
program is due to booting up as opposed to some other criteria.
However, one is free to store a side database. In that, one can cache
WatchPath modification dates / details. One can then use these values
to determine whether to proceed with other transactions.
2) And still, if I refactor my code to use ex. sockets, how do I
change RunAtLoad key value from within the daemon?
Would
launch_data_set_bool (runatload_key, ( user_defined_value ==
true_value ) ? true: false )
be enough, or do I need to send some message?
I insist, cause this seems to be the most elegant way so far.
Just set RunAtLoad to true in the property-list and have the job early
exit if it finds no work to do.
davez
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden