~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/radvd

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
 
3
 
### BEGIN INIT INFO
4
 
# Provides:          radvd
5
 
# Required-Start:    $syslog $remote_fs $network
6
 
# Required-Stop:     $syslog $remote_fs $network
7
 
# Default-Start:     2 3 4 5
8
 
# Default-Stop:      0 1 6
9
 
# Short-Description: Router Advertising Daemon
10
 
### END INIT INFO
11
 
 
12
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
 
DAEMON=/usr/sbin/radvd
14
 
NAME=radvd
15
 
DESC=radvd
16
 
CONFIG=/etc/radvd.conf
17
 
PIDDIR=/var/run/radvd
18
 
PIDFILE=$PIDDIR/radvd.pid
19
 
OPTIONS="-u radvd -p $PIDFILE"
20
 
PROC_SYS_IP6_FORWARDING=/proc/sys/net/ipv6/conf/all/forwarding
21
 
 
22
 
. /lib/lsb/init-functions
23
 
 
24
 
test -x $DAEMON || exit 0
25
 
 
26
 
set -e
27
 
 
28
 
# Check for IPv6 support in kernel
29
 
if [ "$(uname -s)" != "GNU/kFreeBSD" ]; then
30
 
  if test \! -e /proc/sys/net/ipv6; then
31
 
    echo "IPv6 support must be enabled in the kernel for $DESC to work."
32
 
    exit
33
 
  fi
34
 
fi
35
 
 
36
 
chkconfig() {
37
 
  if [ "$(uname -s)" != "GNU/kFreeBSD" ]; then
38
 
    if [ ! -e $CONFIG -o ! -s $CONFIG ]; then
39
 
        echo ""
40
 
        echo "* $CONFIG does not exist or is empty."
41
 
        echo "* See /usr/share/doc/radvd/README.Debian"
42
 
        echo "* radvd will *not* be started."
43
 
        exit 0
44
 
    elif [ ! -e $PROC_SYS_IP6_FORWARDING -o \
45
 
        "$(cat $PROC_SYS_IP6_FORWARDING)" = "0" ]; then
46
 
        echo ""
47
 
        echo "* IPv6 forwarding seems to be disabled."
48
 
        echo "* See /usr/share/doc/radvd/README.Debian"
49
 
        echo "* radvd will *not* be started."
50
 
        exit 0
51
 
    fi
52
 
  fi
53
 
}
54
 
 
55
 
case "$1" in
56
 
  start)
57
 
        echo -n "Starting $DESC: "
58
 
        chkconfig
59
 
 
60
 
        # Anything under /var/run can go away on reboot
61
 
        [ -e $PIDDIR ] || install -d -o radvd -g root -m 4755 $PIDDIR
62
 
 
63
 
        if ! start-stop-daemon --oknodo --start --pidfile $PIDFILE \
64
 
                --exec $DAEMON -- $OPTIONS; then
65
 
          echo "failed." && exit 1
66
 
        fi
67
 
        echo "$NAME."
68
 
        ;;
69
 
  stop)
70
 
        echo -n "Stopping $DESC: "
71
 
        start-stop-daemon --oknodo --stop --pidfile $PIDFILE \
72
 
                --exec $DAEMON
73
 
        echo "$NAME."
74
 
        ;;
75
 
  reload|force-reload)
76
 
        echo "Reloading $DESC configuration files."
77
 
        start-stop-daemon --stop --signal HUP --quiet --pidfile \
78
 
            $PIDFILE --exec $DAEMON
79
 
        ;;
80
 
  restart)
81
 
        invoke-rc.d $NAME stop
82
 
        invoke-rc.d $NAME start
83
 
        ;;
84
 
  status)
85
 
        status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
86
 
        ;;
87
 
  *)
88
 
        N=/etc/init.d/$NAME
89
 
        echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
90
 
        exit 1
91
 
        ;;
92
 
esac
93
 
 
94
 
exit 0