File: init

package info (click to toggle)
minissdpd 1.6.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 508 kB
  • sloc: ansic: 5,076; sh: 290; makefile: 101; python: 40
file content (104 lines) | stat: -rw-r--r-- 2,355 bytes parent folder | download
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
102
103
104
#!/bin/sh -e

### BEGIN INIT INFO
# Provides:          minissdpd
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $local_fs $network $time
# Should-Stop:       $local_fs $network $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: keep memory of all UPnP devices that announced themselves
# Description:       MiniSSDPd is a small daemon used by MiniUPnPc (a UPnP control point for IGD
#                    devices) to speed up device discoveries. MiniSSDPd keep memory of all UPnP
#                    devices that announced themselves on the network through SSDP NOTIFY packets.
#                    MiniSSDPd also has the ability to handle all SSDP traffic recieved on a
#                    computer via the multicast group 239.255.255.250:1900.
### END INIT INFO

NAME=MiniSSDPd
DESC="UPnP devices daemon"
DAEMON=/usr/sbin/minissdpd
DEFAULT_FILE=/etc/default/minissdpd
PIDFILE=/var/run/minissdpd.pid

[ -x "${DAEMON}" ] || exit 0

. /lib/lsb/init-functions

case "$1" in
	start)
		if [ -r "${DEFAULT_FILE}" ] ; then
			. "${DEFAULT_FILE}"
		else
			log_daemon_msg "MiniSSDPd: Default file not found; exiting"
			log_end_msg 1
			exit 1
		fi

		if [ "${START_DAEMON}" != 1 ] ; then
			log_daemon_msg "MiniSSDPd: START_DAEMON is not set to 1; exiting"
			log_end_msg 1
			exit 1
		fi

		if [ -z "${MiniSSDPd_INTERFACE_ADDRESS}" ] ; then
			log_daemon_msg "MiniSSDPd: No interface defined; exiting"
			log_end_msg 1
			exit 1
		fi

		log_daemon_msg "Starting ${DESC}" "${NAME}"

		listening_ip=
		for ip_or_iface in ${MiniSSDPd_INTERFACE_ADDRESS} ; do
			listening_ip="${listening_ip} -i ${ip_or_iface}"
		done

		start-stop-daemon --start --pidfile "${PIDFILE}" --exec "${DAEMON}" -- ${listening_ip} ${MiniSSDPd_OTHER_OPTIONS}
		RET=$?
		case "${RET}" in
			0|1)
				log_end_msg 0
			;;

			*)
				log_end_msg 1
				exit 1
			;;
		esac
	;;

	stop)
		log_daemon_msg "Stopping ${DESC}" "${NAME}"
		start-stop-daemon --stop --oknodo --pidfile "${PIDFILE}"
		RET=$?
		case "${RET}" in
			0|1)
				log_end_msg "${RET}"
			;;

			*)
				log_end_msg 1
				exit 1
			;;
		esac
	;;

	status)
		status_of_proc "${DAEMON}" "${NAME}"
		exit $?
	;;

	restart|reload|force-reload)
		$0 stop
		sleep 1
		$0 start
	;;

	*)
		echo "Usage: ${0} {start|stop|status|restart|reload}"
		exit 1
esac

exit 0