File killerd of Package killerd

#! /bin/sh

# Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
# All rights reserved.


### BEGIN INIT INFO
# Provides:                     killerd 
# Required-Start:               $local_fs
# Required-Stop:                $local_fs
# Default-Start:                3 5
# Default-Stop:                 0 1 2 6
# Short-Description:            Daemon for automatic killing of login shells 
# Description:                  KillerD is a simple daemon for automatic killing of login shells with idle time exceeding given limits, runaway processes and other system hogs. Almost everything can be easily configured.
### END INIT INFO

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

. /etc/rc.status

KILLERD_BIN=/usr/sbin/killerd
test -x $KILLERD_BIN || { echo "$KILLERD_BIN not installed"; 
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }


case "$1" in
    start)
        echo -n "Starting killerd"
        startproc -q $KILLERD_BIN

        rc_status -v
        ;;


    stop)
        echo -n "Shutting down killerd"

        killproc -TERM $KILLERD_BIN 

        rc_status -v
        ;;
    try-restart|condrestart)
        if test "$1" = "condrestart"; then
                echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
        fi
        $0 status
        if test $? = 0; then
                $0 restart
        else
                rc_reset
        fi
        rc_status
        ;;
    restart)
        $0 stop
        $0 start

        rc_status
        ;;
    force-reload)

        $0 try-restart
        rc_status
        ;;
    reload)
        rc_failed 3
        rc_status -v
        ;;
    status)
        echo -n "Checking for service killerd"
        checkproc $KILLERD_BIN
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
        exit 1
        ;;
esac
rc_exit

openSUSE Build Service is sponsored by