File wicd.init 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` || exit 0
/bin/rm $PIDFILE
kill -9 `pgrep wicd` || exit 0 # die, die, die... (thanks to python)
kill -9 `pgrep monitor` || exit 0 # DIE!
else
kill -9 `pgrep monitor` || exit 0 # DIE!
kill -9 `pgrep wicd` || exit 0
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 "Restarting wicd (dummy way to kill the process)"
if [ -f $PIDFILE ]; then
kill -9 `cat $PIDFILE` || exit 0
/bin/rm $PIDFILE
kill -9 `pgrep wicd` || exit 0
kill -9 `pgrep monitor` || exit 0
fi
kill -9 `pgrep wicd` || exit 0
kill -9 `pgrep monitor` || exit 0
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|restart|status}"
exit 1
;;
esac