summaryrefslogtreecommitdiff
path: root/network/radvd/rc.radvd.new
blob: a68c057eabdc06bdcf2075c894a233ea07614481 (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
#!/bin/sh
#
# /etc/rc.d/rc.radvd
#
# Start/stop/restart the radvd daemon.

if ! [ -f /proc/net/if_inet6 ]; then
   echo "IPv6 support not found, exiting"
   exit 1
fi

radvd_start() {
   if [ -x /usr/sbin/radvd ]; then
      echo "Starting radvd..."
      echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
      mkdir -p /var/run/radvd
      chown daemon:daemon /var/run/radvd
      /usr/sbin/radvd -u daemon
   fi
}

radvd_stop() {
   /bin/kill $(cat /var/run/radvd/radvd.pid)
}

radvd_restart() {
   radvd_stop
   sleep 2
   radvd_start
}

case "$1" in
'start')
  radvd_start
  ;;
'stop')
  radvd_stop
  ;;
'restart')
  radvd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac