Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

start-stop-daemon : questions about retry

920 views
Skip to first unread message

- -

unread,
Jan 6, 2013, 5:40:02 AM1/6/13
to
Hello,

I am trying to write an init script for cherokee webserver. Not, there is already one, but I wanted to have one derived from skeleton.



In function "do_stop()" the script executes this line:
"start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME"

But nothing happens. I get exit code 1, which means that the daemon was already stopped. But that is not true. The daemon was still running and not cherokee, nor it's subprocesses were stopped.

Am I doing something wrong here?

THanks


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/1357467043.901...@web140506.mail.bf1.yahoo.com

Darac Marjal

unread,
Jan 7, 2013, 6:40:02 AM1/7/13
to
On Sun, Jan 06, 2013 at 02:10:43AM -0800, - - wrote:
> Hello,
>
> I am trying to write an init script for cherokee webserver. Not, there is already one, but I wanted to have one derived from skeleton.
>
>
>
> In function "do_stop()" the script executes this line:
> "start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME"

Right, I believe that this will find a process with the name $NAME and
the pid specified in $PIDFILE and then send SIGTERM to that process,
wait 30 seconds, then SIGKILL and wait 5 seconds (if the process stops
within that 35 seconds, that's good, otherwise s-s-d will return 2).

So, probably the first thing to check is that $PIDFILE and $NAME have
the values you want and that $PIDFILE exists and has a pid stored in it.
signature.asc

- -

unread,
Jan 10, 2013, 5:00:02 AM1/10/13
to
Hi Darac,

unfortunately that’s already the case. But today I have a different behaviour. Cherokee stops, but doesn't kill php-cgi. Very very wierd.

# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www-data  1294  0.1  0.7 193960 44688 ?        S    Jan09   1:07 php-cgi -b 127.0.0.1:47990
root      1374  0.0  0.0  24712   764 ?        Ssl  Jan09   0:00 /usr/local/sbin/cherokee -d
www-data  1376  0.0  0.1 794328 10528 ?        Sl   Jan09   0:01 /usr/local/sbin/cherokee-worker
www-data  1378  0.0  0.0  76372  2156 ?        S    Jan09   0:00 /usr/bin/rrdtool -
[…]

# cat /usr/local/var/run/cherokee.pid
1374

# start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /usr/local/var/run/cherokee.pid --name cherokee

#ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www-data  1294  0.1  0.7 193960 44688 ?        S    Jan09   1:08 php-cgi -b 127.0.0.1:47990
[…]

Does this have something to do with the script, or with cherokee?

Cheers

Stadtpirat


________________________________
Von: Darac Marjal <maili...@darac.org.uk>
An: debia...@lists.debian.org
Gesendet: 12:32 Montag, 7.Januar 2013
Betreff: Re: start-stop-daemon : questions about retry

Archive: http://lists.debian.org/1357811702.222...@web140503.mail.bf1.yahoo.com

Bob Proulx

unread,
Jan 11, 2013, 3:40:03 PM1/11/13
to
- - wrote:
> unfortunately that’s already the case. But today I have a different
> behaviour. Cherokee stops, but doesn't kill php-cgi. Very very
> wierd.

In order to understand whether this is normal or not we would need to
know how you have set up php-cgi. It could go either way.

> # ps aux
> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> www-data 1294 0.1 0.7 193960 44688 ? S Jan09 1:07 php-cgi -b 127.0.0.1:47990
> root 1374 0.0 0.0 24712 764 ? Ssl Jan09 0:00 /usr/local/sbin/cherokee -d
> www-data 1376 0.0 0.1 794328 10528 ? Sl Jan09 0:01 /usr/local/sbin/cherokee-worker
> www-data 1378 0.0 0.0 76372 2156 ? S Jan09 0:00 /usr/bin/rrdtool -

Having grown up with SysV I like seeing the parent process id PPID
too. Then you can tell if the process parent is 1 or not. 'ps -ef'
or 'ps -efH' shows this. I don't know the BSD ps option to show the
PPID.

> # cat /usr/local/var/run/cherokee.pid
> 1374

That matches fine.

> # start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /usr/local/var/run/cherokee.pid --name cherokee
>
> #ps aux
> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> www-data 1294 0.1 0.7 193960 44688 ? S Jan09 1:08 php-cgi -b 127.0.0.1:47990

The start-stop-daemon stopped cherokee fine.

> Does this have something to do with the script, or with cherokee?

It certainly has nothing to do with start-stop-daemon since it did
exactly as it was told. The behavior of start-stop-daemon seems fine.

If you think cherokee should have stopped php-cgi then you would need
to tell us more about how you have it configured. But this is very
cherokee specific, has little to do with Debian itself, and so you
would probably get better specific knowledge about cherokee on a
cherokee specific mailing list.

Bob
signature.asc

Tom H

unread,
Jan 11, 2013, 5:50:01 PM1/11/13
to
On Fri, Jan 11, 2013 at 3:33 PM, Bob Proulx <b...@proulx.com> wrote:
> - - wrote:
>>
>> # ps aux
>> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
>> www-data 1294 0.1 0.7 193960 44688 ? S Jan09 1:07 php-cgi -b 127.0.0.1:47990
>> root 1374 0.0 0.0 24712 764 ? Ssl Jan09 0:00 /usr/local/sbin/cherokee -d
>> www-data 1376 0.0 0.1 794328 10528 ? Sl Jan09 0:01 /usr/local/sbin/cherokee-worker
>> www-data 1378 0.0 0.0 76372 2156 ? S Jan09 0:00 /usr/bin/rrdtool -
>
> Having grown up with SysV I like seeing the parent process id PPID
> too. Then you can tell if the process parent is 1 or not. 'ps -ef'
> or 'ps -efH' shows this. I don't know the BSD ps option to show the
> PPID.

ps ax --sort=pid o user,pid,ppid,%cpu,%mem,...


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SyMoZ9THGXLSoQjZWEXQ8z...@mail.gmail.com

- -

unread,
Jan 15, 2013, 8:10:02 AM1/15/13
to
Hi Bob,

I checked the processes with ps -efH (thanks for that command) and everythings looked okay. After looking through the script I found a tiny typo. Embarassing, I know … So thanks everyone, my script is working now!

Anyway, here the output of "ps -efH":
root@euve3638:~# ps -efH
UID        PID  PPID  C STIME TTY          TIME CMD
[…]
root     18092     1  0 Jan12 ?        00:00:00   /usr/local/sbin/cherokee -d
www-data 18390 18092  0 Jan12 ?        00:00:11     /usr/local/sbin/cherokee-worker
www-data 18393 18390  0 Jan12 ?        00:00:00       /usr/bin/rrdtool -
www-data 32698 18092  0 05:36 ?        00:01:05     php-cgi -b 127.0.0.1:47990

- Stadtpirat



Von: Bob Proulx <b...@proulx.com>
An: debia...@lists.debian.org
Gesendet: 21:33 Freitag, 11.Januar 2013

Betreff: Re: start-stop-daemon : questions about retry
0 new messages