File wicd.init.old of Package wicd

#! /bin/sh
#
# adopted for openSUSE by sda00
#
# /etc/init.d/wicd
#
### BEGIN INIT INFO
# Provides:       wicd-daemon
# Required-Start: $local_fs $remote_fs dbus haldaemon
# Required-Stop:  $null
# Should-Start: isdn SuSEfirewall2_init
# Should-Stop:	$null
# Default-Start:  2 3 5
# Default-Stop:
# Short-Description: Configure the network
# Description: wicd, a wired and wireless connection manager.
### END INIT INFO

# comments by sda00 <sda00@himki.net>

WICD_BIN=/usr/sbin/wicd
test -x $WICD_BIN || exit 5
PIDFILE=/var/run/wicd/wicd.pid  # the location could depend on the distro specific and may vary

. /etc/rc.status
rc_reset

case "$1" in
        start)
                #checkproc $WICD_BIN - NO WAY! it calls python and generate 2 PID's!
                if [  -f $PIDFILE ]; then
                        echo -n "wicd already running"
                        rc_status -v
                        rc_exit
                else
                echo -n "Starting wicd"
                /sbin/startproc $WICD_BIN &
                rc_status -v
                fi
                ;;
        stop)
                echo -n "Shutting down wicd"
                #/sbin/killproc -TERM $WICD_BIN - useless shit :)
                if [ -f $PIDFILE ]; then
                kill -9 `cat $PIDFILE`
                /bin/rm $PIDFILE
                kill -9 `pgrep wicd` # die, die, die... (thanks to python)
                fi
                rc_status -v
                ;;
#        restart) # require some tweaking, because 'start' makes 2 PID's and 'stop' terminates the routine
#		  # was lazy to manage it. sart and stop called one after another work. use it.
#                #$0 stop
#                #$0 start
#                echo -n "Shutting down wicd"
#		if [ -f $PIDFILE ]; then
#		kill -9 `cat $PIDFILE`
#		/bin/rm $PIDFILE
#		kill -9 `pgrep wicd`
#		fi
#		rc_status -v
#		echo -n "Starting wicd"
#		/sbin/startproc $WICD_BIN &
#		rc_status -v
#                #rc_status
#                ;;
        status)
                echo -n "Checking for wicd: "
                if [ -f $PIDFILE ]; then rc_status -v ; else  rc_status -v ; fi
                ;;
        *)
                echo "Usage: $0 {start|stop|status}"
                exit 1
                ;;
esac
openSUSE Build Service is sponsored by