[systemd-devel] ExecStop required in service file?

Michal Schmidt mschmidt at redhat.com
Mon Nov 14 08:59:35 PST 2011


On Mon, 14 Nov 2011 10:51:55 -0500 Michael D. Berger wrote:
> On my F16_64, mySrvDaemon is a tcp/ip server involving posix
> threads, written in C++.  mySrvDaemon.service:
> 
>  [Unit]
>  Description=Server Service
>  After=syslog.target network.target
> 
>  [Service]
>  PIDFile=/var/lock/subsys/mySrvDaemon
>  Type=simple

Shouldn't this be "Type=forking"? Does mySrvDaemon fork by itself or
not?

>  ControlGroup=cpu:/
>  ExecStart=/usr/sbin/mySrvDaemon --daemon
>  ExecStop=/bin/kill -TERM $MAINPID
> 
>  [Install]
>  WantedBy=multi-user.target
> 
> Originally, I did not have the ExecStop line.  But in
> that case, shutdown hangs up near the beginning.  The
> only way out is to power down.

Have you tried waiting a few minutes, in case a timeout kicks in?

> BTW, the TERM signal
> is intercepted by mySrvDaemon and does an immediate
> exit(0).
> 
> The lockup occurs even if I do:
>    systemctl stop mySrvDaemon
>    ps -ef | grep mySrvDaemon | grep -v grep
>    # it seems to be gone

What does "systemctl status mySrvDaemon.service" say at this moment?
And "systemctl list-jobs"?

Michal



More information about the systemd-devel mailing list