summaryrefslogtreecommitdiffstats
path: root/projectroot/etc/init.d/avahi-daemon
blob: 27c22cc52446b0cdace8437a23e9897dcdd9c30d (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
#
# This is a avahi-daemon init.d script which is called by init(1) with [start|stop] as argument
# Mi 22. Jul 21:46:28 CEST 2009

#set -e
PATH=/sbin:/bin:/usr/bin
BINARY=/usr/sbin/avahi-daemon
OPTIONS="-D"

test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; }
test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon

start_proc(){
$BINARY -c && return 0
$BINARY $OPTIONS
case $? in
	0)
	echo " [+] (avahi-daemon)"
	;;
	*)
	echo " [!] (avahi-daemon)"
	;;
esac
}

stop_proc(){
if $BINARY -c ; then 
   $BINARY -k 
	case $? in
	0)
	echo " [-] (avahi-daemon)"
	;;
	*)
	echo " [!] (avahi-daemon)"
	;;
	esac
fi
}

refresh_proc(){
if $BINARY -c ; then 
   $BINARY -r 
	case $? in
	0)
	echo " [*] (avahi-daemon)"
	;;
	*)
	echo " [!] (avahi-daemon)"
	;;
	esac
fi
}

check_proc(){
$BINARY -c
case $? in
	0)
	echo " [+] (avahi-daemon)"
	;;
	*)
	echo " [-] (avahi-daemon)"
	;;
esac
}



case "$1" in
	start)
		start_proc
		;;
	stop)
		stop_proc
		;;
	restart|force-reload)
		stop_proc
		sleep 2
		start_proc
		;;
	reload)
		refresh_proc
		;;
	status)
		check_proc
		;;
	*)
		echo "Usage: $0 {start|stop|status|reload|restart|force-reload}"
		echo ""
		echo "Status Flags:"
		echo "[+] -> started"
		echo "[-] -> not started"
		echo "[*] -> reloaded"
		echo "[!] -> error - please debug without -D option"
		echo ""
		exit 1
		;;
esac

exit 0