[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: killproc

On Wed, Nov 30, 2005 at 10:00:34AM +0000, John Talbut wrote:
> Tim Ruehsen wrote:
> >>I have an external programme that is calling for the function killproc. 
> >> This is apparently not available in Debian Sarge.

If it's a shell script, you could change it to include 

> >>
> >>What is the policy?  What is the story?  What should be used instead?
> >
> >
> >If you are using killproc for sending signals to processes by name 
> >(instead of by processid) give killall a try. It belongs to the packet 
> >'psmisc'.
> >
> >Tim
> >
> Yes, thanks.  pkill also seems to be a possibility.  And I would like to 
> know more.  Debian does not seem to give any explanation as to why it 
> does not use killproc.  Do they suggest an "official" alternative?

The function "killproc" *is* in the file /lib/lsb/init-functions, even in Sarge:

killproc () {
    local pidfile sig status
    set -- `POSIXLY_CORRECT=1 getopt "p:" $*`

    for i in $*; do
        case $i in
            -p)  pidfile=$2; shift 2;;
            --)  shift; break;;

    if [ ! $pidfile ]; then
        pidfile=/var/run/$(basename "$1").pid

    if [ $2 ]; then
        sig=$(echo $2 | sed -e 's/^-\(.*\)/\1/')
        sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
        /sbin/start-stop-daemon --stop --pidfile "$pidfile" --signal $sig --quiet
        [ "$status" = 1 ] && return 3 # program is not running
        return 0
        /sbin/start-stop-daemon --stop --pidfile "$pidfile" --retry 5 --quiet --oknodo

Debian unstable uses it, at least:
$ grep -R killproc /etc/init.d/
/etc/init.d/autofs:        killproc $DAEMON -USR2 >& /dev/null
/etc/init.d/clamav-freshclam:    killproc -p $PIDFILE $DAEMON
/etc/init.d/clamav-freshclam:  killproc -p $PIDFILE $DAEMON 1
/etc/init.d/clamav-daemon:      killproc -p $THEPIDFILE
/etc/init.d/clamav-daemon:      killproc -p $SUPERVISORPIDFILE
/etc/init.d/clamav-daemon:  killproc -p $THEPIDFILE $DAEMON USR2
/etc/init.d/clamav-daemon:  killproc -p $THEPIDFILE $DAEMON 1

Attachment: signature.asc
Description: Digital signature

Reply to: