daemondo defeats purpose of launchd?

James Berry jberry at macports.org
Wed Sep 5 20:36:29 PDT 2007


On Sep 5, 2007, at 6:48 PM, markd at macports.org wrote:

> James Berry <jberry at macports.org> writes:
>> For those cases where startupitem.executable cannot be used, daemondo
>> also supports the startupitem.pidfile commands that allow the
>> process' pidfile to be monitored: daemondo will read the pidfile and
>> watch for the death of that process.
>
>> So daemondo, and thus launchd, will be aware of the daemon process
>> death (and be able to restart the daemon process) only under two
>> circumstances:
>>
>> 	(1) startupitem.executable was supplied (thus daemondo starts the
>> process)
>> 	(2) startupitem.pidfile was supplied (thus daemondo reads the
>> process id)
>>
>> Under all other circumstances, daemondo will not know that the daemon
>> process has died, and will not exit when the process does die, and
>> thus launchd won't restart the process since it doesn't  know it
>> died. Put another way, if daemondo can know the process has died,
>> then launchd will know too, but not otherwise.
>>
> These statements seem incompatible with ....
>>
>> The pidfile keyword is likely used only if executable is not.
>
> This one.

I don't see  the incompatibility of those statements, but then I again  
I know what i meant, not necessarily what it means to others ;). The  
later sentence, btw, is missing a word on the end. It should read:  
"the pidfile keyword is likely useful only if the executable keyword  
is not specified." Does that help any?

> Looks to me like startupitem.pidfile must be set for a deamon to be
> tracked whether it is executable startupitem or not.

No, daemondo will track an "executable" in an case (and it doesn't  
need to know where their pidfile is, generally, since it launches the  
code and thus knows the pid). In the case of script code (non  
"executable") daemondo doesn't know the pid, since it doesn't know  
what the script code did. In this case, it has to rely on reading a  
pidfile to get the process id, or else simply not know.

> And the man page
> says startupitem.pidfile is "particularly useful" for
> startupitem.executable.  Can you explain this?

That was either garbage to begin with, or else got messed up in  
creation of the man page. Off the top of my head I can't see any  
particular reason to use a pidfile keyword in conjunction with the  
executable keyword, unless it's to specify that it should delete a  
pidfile created by the executable, and I'm not sure that even works  
for that case.

Hope that helps.

James



More information about the macports-dev mailing list