summaryrefslogtreecommitdiff
path: root/initscript/Slackware/rc.networkmanager
blob: 6f89385386f6be0e256b522355417b4b14060a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#
# NetworkManager:   NetworkManager daemon
#
# description:  This is a daemon for automatically switching network \
#               connections to the best available connection. \
#
# processname: NetworkManager
# pidfile: /var/run/NetworkManager.pid
#
# We need /sbin/ip
[ -x /sbin/ip ] || exit 1

processname=NetworkManager
servicename=NetworkManager
pidfile=/var/run/NetworkManager.pid

RETVAL=0

start()
{
	if [ "`pgrep dbus-daemon-1`" = "" ]; then
		echo -n "D-BUS must be running to start NetworkManager"
		exit 1
	fi
	if [ "`pgrep hald`" = "" ]; then
		echo -n "HAL must be running to start NetworkManager"
		exit 1
	fi
 
	echo -n $"Starting NetworkManager daemon: "
	$servicename
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && echo `/sbin/pidof $processname` > $pidfile
}

stop()
{
	echo -n $"Stopping NetworkManager daemon: "

	killall -s TERM $servicename
	RETVAL=$?
	echo
	if [ $RETVAL -eq 0 ]; then
		rm -f $pidfile
	fi
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	*)
		echo $"Usage: $0 {start|stop|restart}"
		;;
esac
exit $RETVAL