Subject: Re: Suiqd as service [was: Re: New on sources: cygrunsrv-0.92]
From: "Gerrit P. Haase" <[email-masked]>
To: Corinna Vinschen <[email-masked]>
Date: Fri, 18 May 2001 00:02:09 +0200

Corinna Vinschen schrieb am 2001-05-17, 22:28:

> > No error...
> >
> > However, httpd is running.
> 
> Which probably means that apache has forked a daemon.
> 
> > You also wrote, it couldn't be killed, if a daemon forks and the parent
> > dies, but that is not absolutely correct. Cygrunsrv is listed as a task
> > and cygrunsrv could be killed, so the process it invokes dies, too.
> 
> ? You're mixing two different things. Either the application forks/exits
> and cygrunsrv behaves as above. In that case there's no cygrunsrv process.
> Or the child app doesn't fork and you should not kill cygrunsrv but send
> a stop message by calling `cygrunsrv -E <svcname>' or `net stop <svcname>'.
> In that case, cygrunsrv sends a SIGTERM to it's child application to
> give it a chance to close it's service gracefully. Killing cygrunsrv
> is somewhat violent.

Well, it is obviously not like this, httpd father process is forking,
the service stops (so it is logged in eventlog), but cygrunsrv 'task' 
is still running. 
I think Apache is forking off some child processes, but it is not
exiting. So cygrunsrv process is active and Apache is running.

Normally the original (father process) of Apache is killed to 
stop it.
But in eventlog it is this message control panel shows service is not 
running.

The behaviour if i try to stop Apache (which is running, but it is 
not running) with cygrunsrv is:

$ cygrunsrv -S 'Cygwin Apache'

$ ps -e
      PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
      276       1     276        276   0  500   May 15 /usr/bin/bash
      307       1     307        307  -1   18   May 15 /usr/local/bin/ipc-daemon
      315       1     315        315   1  500   May 16 /usr/bin/bash
      301       1     301        301   2  500   May 16 /usr/bin/bash
      405       1     405        405   3  500   May 16 /usr/bin/bash
      404       1     404        404   4  500   May 16 /usr/bin/bash
      343       1     343        343   5  500 00:49:19 /usr/bin/bash
      147     315     147        278   1  500 21:36:52 /usr/local/bin/perl
       96       1      96         96  -1   18 21:42:09 /usr/bin/cygrunsrv
      577      96      96        359  -1   18 21:42:10 /usr/local/sbin/cron
      584       1     584        584  -1   18 21:42:38 /usr/sbin/inetd
      562     584     584        562  -1   18 21:42:38 /usr/sbin/inetd
      537       1     537        537  -1   18 23:48:43 /usr/sbin/httpd
      505     537     537        505  -1   18 23:48:44 /usr/sbin/httpd
      241     537     537        241  -1   18 23:48:44 /usr/sbin/httpd
      540     537     537        540  -1   18 23:48:45 /usr/sbin/httpd
      493     537     537        493  -1   18 23:48:45 /usr/sbin/httpd
      198     343     198        504   5  500 23:49:04 /usr/bin/ps

Hmm, here cygrunsrv isn't shown as active task, 
or in process-list in the taskmanager.
But in the applicationlist of taskmanager it is shown two times now.
Does it follow the childs?
What is w*ndows showing here?

siebenschlaefer@LORELEY /
$ cygrunsrv -E 'Cygwin Apache'

siebenschlaefer@LORELEY /
$ ps -e
      PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
      276       1     276        276   0  500   May 15 /usr/bin/bash
      307       1     307        307  -1   18   May 15 /usr/local/bin/ipc-daemon
      315       1     315        315   1  500   May 16 /usr/bin/bash
      301       1     301        301   2  500   May 16 /usr/bin/bash
      405       1     405        405   3  500   May 16 /usr/bin/bash
      404       1     404        404   4  500   May 16 /usr/bin/bash
      343       1     343        343   5  500 00:49:19 /usr/bin/bash
      147     315     147        278   1  500 21:36:52 /usr/local/bin/perl
       96       1      96         96  -1   18 21:42:09 /usr/bin/cygrunsrv
      577      96      96        359  -1   18 21:42:10 /usr/local/sbin/cron
      584       1     584        584  -1   18 21:42:38 /usr/sbin/inetd
      562     584     584        562  -1   18 21:42:38 /usr/sbin/inetd
      537       1     537        537  -1   18 23:48:43 /usr/sbin/httpd
      505     537     537        505  -1   18 23:48:44 /usr/sbin/httpd
      241     537     537        241  -1   18 23:48:44 /usr/sbin/httpd
      540     537     537        540  -1   18 23:48:45 /usr/sbin/httpd
      493     537     537        493  -1   18 23:48:45 /usr/sbin/httpd
      401     343     401        508   5  500 23:53:18 /usr/bin/ps

$ kill 537
bash: kill: (537) - Not owner

I am able to kill it now if i shut down the second cygrunsrv process 
in the first register of Task-Manager.
Oops, shut down the wrong, (cron-service), at first...
There is no number, cygrunsrv is not listed in task list,
i am not able to kill any of the httpd tasks, but now it is 
off.

$ ps -e
      PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
      276       1     276        276   0  500   May 15 /usr/bin/bash
      307       1     307        307  -1   18   May 15 /usr/local/bin/ipc-daemon
      315       1     315        315   1  500   May 16 /usr/bin/bash
      301       1     301        301   2  500   May 16 /usr/bin/bash
      405       1     405        405   3  500   May 16 /usr/bin/bash
      404       1     404        404   4  500   May 16 /usr/bin/bash
      343       1     343        343   5  500 00:49:19 /usr/bin/bash
      147     315     147        278   1  500 21:36:52 /usr/local/bin/perl
      584       1     584        584  -1   18 21:42:38 /usr/sbin/inetd
      562     584     584        562  -1   18 21:42:38 /usr/sbin/inetd
      572     343     572        472   5  500 23:57:41 /usr/bin/ps

-- 
=^..^=

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple