1
0
mirror of https://github.com/gryf/wicd.git synced 2026-02-23 18:45:48 +01:00

Modified two initscripts to support wicd -k, made wicd -k have a non-zero exit code if it can't find a daemon to kill.

This commit is contained in:
Andrew Psaltis
2009-12-29 21:22:23 -05:00
parent ff6cca2528
commit 49ed9f6251
4 changed files with 37 additions and 10 deletions

View File

@@ -22,13 +22,28 @@ start()
echo echo
[ "$RETVAL" = "0" ] && touch /var/lock/subsys/$servicename [ "$RETVAL" = "0" ] && touch /var/lock/subsys/$servicename
} }
stop() stop()
{
echo -n "Stopping wicd service and closing connections: "
$WICD_BIN -k
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
rm -f /var/lock/subsys/$servicename
rm -f $pidfile
else
echo_failure
fi
echo
}
force_stop()
{ {
echo -n "Stopping wicd service: " echo -n "Stopping wicd service: "
killproc -p $pidfile wicd killproc -p $pidfile wicd
RETVAL=$? RETVAL=$?
echo echo
if [ $RETVAL -eq 0 ]; then if [ $retval -eq 0 ]; then
rm -f /var/lock/subsys/$servicename rm -f /var/lock/subsys/$servicename
rm -f $pidfile rm -f $pidfile
fi fi
@@ -42,16 +57,19 @@ case "$1" in
stop) stop)
stop stop
;; ;;
force_stop)
force_stop
;;
status) status)
status -p $pidfile $processname status -p $pidfile $processname
RETVAL=$? RETVAL=$?
;; ;;
restart | reload) restart | reload)
stop force_stop
start start
;; ;;
*) *)
echo "Usage: wicd {start|stop|status|reload|restart}" echo "Usage: wicd {start|stop|force_stop|status|reload|restart}"
exit 1 exit 1
;; ;;
esac esac

View File

@@ -3,7 +3,7 @@
# /etc/rc.d/rc.wicd # /etc/rc.d/rc.wicd
# Start/stop/restart the Wicd daemon # Start/stop/restart the Wicd daemon
# This is defined in /usr/lib/python2.5/site-packages/wicd/wpath.py # This is defined in /usr/lib/python2.6/site-packages/wicd/wpath.py
PIDFILE="%PIDFILE%" PIDFILE="%PIDFILE%"
DAEMON="%SBIN%wicd" DAEMON="%SBIN%wicd"
@@ -21,7 +21,7 @@ wicd_start() {
fi fi
} }
wicd_stop() { wicd_force_stop() {
echo "Stopping wicd daemon..." echo "Stopping wicd daemon..."
if [ -e $PIDFILE ]; then if [ -e $PIDFILE ]; then
kill $(cat $PIDFILE) 2>/dev/null kill $(cat $PIDFILE) 2>/dev/null
@@ -31,6 +31,12 @@ wicd_stop() {
fi fi
} }
wicd_stop() {
echo "Stopping wicd daemon and closing connections..."
$DAEMON -k
}
# See how we were called and take appropriate action # See how we were called and take appropriate action
case $1 in case $1 in
@@ -40,8 +46,11 @@ case $1 in
stop) stop)
wicd_stop wicd_stop
;; ;;
restart) force_stop)
wicd_stop wicd_stop
;;
restart)
wicd_force_stop
wicd_start wicd_start
;; ;;
*) *)

View File

@@ -1,5 +1,5 @@
.\" First revision was r203 .\" First revision was r203
.TH WICD-CURSES "8" "April 2009" "wicd-curses-%CURSES_REVNO%" .TH WICD-CURSES "8" "December 2009" "wicd-curses-%CURSES_REVNO%"
.SH NAME .SH NAME
.B wicd-curses .B wicd-curses
\- curses-based wicd(8) controller \- curses-based wicd(8) controller

View File

@@ -1742,8 +1742,8 @@ def main(argv):
try: try:
f = open(wpath.pidfile) f = open(wpath.pidfile)
except: except:
print >> sys.stderr, "No wicd instance active, aborting." #print >> sys.stderr, "No wicd instance active, aborting."
sys.exit(0) sys.exit(1)
from wicd import dbusmanager from wicd import dbusmanager
bus = dbusmanager.connect_to_dbus() bus = dbusmanager.connect_to_dbus()
dbus_ifaces = dbusmanager.get_dbus_ifaces() dbus_ifaces = dbusmanager.get_dbus_ifaces()