1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-26 16:32:34 +01:00
Files
wicd/other/initscripts/slackware/wicd
imdano ef9b5cc7f3 Added distro-specific init scripts based on those used by NM (these are very experimental and likely broken in many cases).
Updated setup.py to pick which initscript to install based on the distro detected.
Updated MANIFEST.in to make sure launchdaemon.sh is included in the sdist build.
Fixed a bunch of crash bugs in tool detection system when tools are detected.
Made tool detection work correctly when "which" returns output if no match is found (as opposed to no output).  Eventually we might want to hardcode possible paths instead of using which at all...
Fixed some message formatting in the daemon.
Added some docstrings.
Added a pidfile system for increased initscript compatibility (sort of, it's somewhat incomplete).
2008-03-24 00:03:35 +00:00

89 lines
1.5 KiB
Bash

#!/bin/sh
#
# wicd: wicd daemon
#
# description: This is a daemon managing network connections.
#
# processname: wicd-daemon
# pidfile: /var/run/wicd.pid
#
WICD_BIN=/opt/wicd/daemon.py
# Sanity checks.
[ -x $WICD_BIN ] || exit 0
PIDFILE=/var/run/wicd.pid
$WICD_EXEC="$WICD_BIN -P $PIDFILE"
wicd_start()
{
if [ "`pgrep dbus-daemon`" = "" ]; then
echo "D-BUS must be running to start wicd"
return
fi
# Just in case the pidfile is still there, we may need to nuke it.
if [ -e "$PIDFILE" ]; then
rm -f $PIDFILE
fi
echo "Starting wicd daemon: $WICD_BIN"
$WICD_EXEC
}
wicd_status()
{
local pidlist=`cat $PIDFILE 2>/dev/null`
if [ -z "$pidlist" ]; then
return 1
fi
local command=`ps -p $pidlist -o comm=`
if [ "$command" != 'wicd-daemon' ]; then
return 1
fi
}
wicd_stop()
{
echo -en "Stopping wicd: "
local pidlist=`cat $PIDFILE 2>/dev/null`
if [ ! -z "$pidlist" ]; then
kill $pidlist &>/dev/null
rm -f $PIDFILE &>/dev/null
fi
echo "stopped";
}
wicd_restart()
{
wicd_stop
wicd_start
}
case "$1" in
'start')
if ( ! wicd_status ); then
wicd_start
else
echo "wicd is already running (will not start it twice)."
fi
;;
'stop')
wicd_stop
;;
'restart')
wicd_restart
;;
'status')
if ( wicd_status ); then
echo "wicd is currently running"
else
echo "wicd is not running."
fi
;;
*)
echo "usage $0 start|stop|status|restart"
esac