Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 126783 - start-stop-daemon can't kill PGIDs
Summary: start-stop-daemon can't kill PGIDs
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-19 04:08 UTC by Peter Hyman
Modified: 2007-08-25 17:43 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch file again ssd 1.10.20 (ssd.diff,1.68 KB, patch)
2006-03-19 05:59 UTC, Peter Hyman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hyman 2006-03-19 04:08:09 UTC
I recently have been evaluating avgfree whose daemon puts the PGID into its pid file, NOT the actual PIDs of any daemons it spawns. In the publisher's init.d script, they use the following to kill the process:

Here is the startup dialog. 17518 is the GID which is not in the process list after spawning its two daemons.

mars ~ # start-stop-daemon --start --exec /opt/grisoft/avg7/bin/avgscan -- -d
AVG7 Anti-Virus command line scanner
Copyright (c) 2006 GRISOFT, s.r.o.
Program version 7.1.24, engine 718
Virus Database: Version 268.2.5/284  2006-03-17
License type is FREE.
avgscan[17518]: Starting AVG Anti-Virus in daemon mode.
avgscan[17519]: AVG Anti-Virus Daemon started.
avgscan[17518]: Starting AVG Anti-Virus on-access scanner.
avgscan[17520]: AVG Anti-Virus on-access scanner started

This is the command avg uses to kill itself.

kill -TERM -`cat /var/run/avgd.pgrp` 

where the minus sign is used to kill all members of the group. The daemon does NOT put a negative number in the pid file.

mars ~ # ps  axj
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
snip...
    1 17519 17518 16951 pts/0    17626 S        0   0:00 /opt/grisoft/avg7/bin/avgscan -d
    1 17520 17518 16951 pts/0    17626 S        0   0:00 /opt/grisoft/avg7/bin/avgscan -d

start-stop-daemon does not seem to have the ability to kill a group by prepending a `-` sign. In order to kill the group, I use --exec name which works OK.

I think there should either be a way to kill a group, OR, at least explain that it cannot be done using start-stop-daemon. Or, am I missing something?

Perhaps an option like --gidfile where it would interpret the process in any such file to be a group id and prepend a negative #.
Comment 1 Peter Hyman 2006-03-19 05:59:14 UTC
Created attachment 82545 [details, diff]
patch file again ssd 1.10.20

patch against start-stop-daemon.c from rc-scripts-1.6.14.tar.bz2.
The intent is to have the option -G|gpidfile replace pidfile ONLY during the stop sequence. It should have no meaning when starting a process, but should not be bad. Note, in the case statement block, I just have it fall through to the pidfile option to get the filename. Just a suggestion. Maybe a better way to do this...
Comment 2 Peter Hyman 2006-03-19 06:29:28 UTC
above kill examples should read:

kill -TERM -- -`cat....`

I omitted the option terminator --.
Comment 3 SpanKY gentoo-dev 2006-04-10 18:14:25 UTC
see if ssd from baselayout-1.12.x does what you need
Comment 4 Peter Hyman 2006-04-11 04:25:24 UTC
I don't use ~x86 for base and core packages. I'll have to wait. Thx