[systemd-devel] How to stop socket-actived inetd-like service?

Colin Guthrie gmane at colin.guthr.ie
Fri Dec 21 06:11:21 PST 2012


'Twas brillig, and Petr Pisar at 20/12/12 13:01 did gyre and gimble:
> Hello,
> 
> having cvs.socket:
> 
> [Unit]
> Description=CVS Server Activation Socket
> [Socket]
> ListenStream=2401
> Accept=true
> [Install]
> WantedBy=sockets.target
> 
> and cvs at .service:
> 
> [Unit]
> Description=CVS Server
> After=local-fs.target
> [Service]
> Environment=HOME=/var/cvs
> ExecStart=-/usr/bin/cvs -f --allow-root=/var/cvs pserver
> StandardInput=socket
> 
> How can I stop all running instances?

You probably want to put:

PartOf=cvs.target

Into your cvs at .service file (assuming you have a semi-recent systemd
version).

That way you can do "systemctl stop cvs.target" and it will kill all
instances.

You will also have to ship a simple .target file too.

> I start cvs.socket, I connect client to the TCP port, and now I want to
> stop all instances. Stopping cvs.socket disappears listening socket, but
> remaining cvs@*.service instances are still running. My naive attept to
> stop ther service is not recognized by systemctl:
> 
> # systemctl stop cvs\@.service
> Failed to issue method call: Unit name cvs at .service is not valid.
> Failed to issue method call: Unit name cvs at .service is not valid.
> # systemctl stop cvs.service
> Failed to issue method call: Unit cvs.service not loaded.

You can control individual units doing:

"systemctl stop cvs at foo.service" (where @foo matches what "systemctl
list-units" returns).

HTHs

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list