[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: init script cannot stop pid process



Am 12.02.2015 um 16:35 schrieb Mateusz Łukasik:
> On 12.02.2015 07:57, Chow Loong Jin wrote:
>> On Wed, Feb 11, 2015 at 10:25:38PM +0100, Mateusz Łukasik wrote:
>>> Hello,
>>>
>>> I make darkhttpd package and have a small issue.
>>>
>>> I prepare init script:
>>> https://github.com/mati75/darkhttpd/blob/master/debian/init and for run
>>> script with start parameter is working fine:
>>
>> This is just a shot in the dark, but how about dropping the --daemon
>> parameter,
>> and telling start-stop-daemon to do the backgrounding?
>>
>> Basically...
>>
>>      start-stop-daemon --start --quiet --pidfile $PIDFILE
>> --make-pidfile \
>>      --background --exec $DAEMON -- $DARKHTTPD_ROOT $DARKHTTPD_FLAGS
>> || true
>>
> 
> 
> The simply way is the best. It definitely fix the issue.

The start-stop-daemon man page clearly states though, that --background
should only be used as a last resort. I would consider this a hack, at best.

Personally, I'd create a subdirectory in /var/run in your init script
before starting the daemon and make sure, the daemon has write
permissions in that directory.
Or you change the code in the daemon, to drop privs *after* writing the
pidfile.



Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: