File: init

package info (click to toggle)
mopd 1%3A2.5.3-21
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 780 kB
  • sloc: ansic: 4,871; makefile: 176; sh: 163
file content (82 lines) | stat: -rw-r--r-- 1,679 bytes parent folder | download | duplicates (2)
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
#! /bin/sh
### BEGIN INIT INFO
# Provides:          mopd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: start The Maintenance Operations Protocol (MOP) loader daemon.
### END INIT INFO

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/mopd
DESC="MOP boot assistant daemon"

IFACE_LIST=""

test -x $DAEMON || exit 0

if [ -f /etc/mopd.conf ] ; then
    . /etc/mopd.conf
fi

if [ "x$INTERFACE" = "x" ]; then
    echo "$DESC disabled, no interfaces."
    exit 0
fi


if [ "$INTERFACE" = "all" ] ; then
	ARGS="-a"
	IFACE_LIST=`sed -e "1,2d" -e "/lo:/d" -e "s/:.*/ /" /proc/net/dev \
		| tr -d "\n"`
	if [ -z "$IFACE_LIST" ] ; then
		echo "No interfaces found, mopd not started."
		exit 0
	fi
else
	ARGS="$INTERFACE"
fi

case "$1" in
  start)
    echo -n "Starting $DESC: "
    
    # enable receipt of multicast packets
    if [ "$IFACE_LIST" ] ; then
    	for IFACE in $IFACE_LIST ; do
    	    /sbin/ifconfig $IFACE allmulti
	done
    else
        /sbin/ifconfig $INTERFACE allmulti 
    fi
    
    if  start-stop-daemon --background --start --exec $DAEMON -- $ARGS ; then
    	echo "mopd."
    else
    	echo "error starting mopd."
    fi 
    ;;
  stop)

  # we don't disable allmulti in case another service needs it
    echo -n "Stopping $DESC: "
    start-stop-daemon --stop --exec $DAEMON
    if [ $? = 0 ] ; then
	echo "mopd."
    fi
    ;;
  reload)
    echo "Not implemented."
    ;;
  force-reload|restart)
    sh $0 stop
    sh $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/mopd {start|stop|restart|force-reload|reload}"
    exit 1
    ;;
esac

exit 0