/etc/init.d/miredo is in miredo 1.2.3-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 105 106 107 108 109 110 111 112 113 | #! /bin/sh
# $Id: miredo.init 240 2010-01-30 20:38:04Z remi $
#
# miredo start/stop script for Debian GNU/Linux
# Author: RĂ©mi Denis-Courmont <remi (at) remlab (dot) net>
#
### BEGIN INIT INFO
# Provides: miredo
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Short-Description: Teredo IPv6 tunnel
# Description: Miredo daemon for tunneling of IPv6 through NAT
# within UDP/IPv4, as specified by the Teredo mechanism.
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="Teredo IPv6 tunneling daemon"
NAME=miredo
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
CHECKCONF="${DAEMON}-checkconf"
[ -x "$DAEMON" ] || exit 0
# Source defaults.
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Ensure configuration is readable.
[ -r /etc/miredo/$NAME.conf ] || exit 0
. /lib/lsb/init-functions
check_start() {
if [ "x$START_MIREDO" != "xtrue" ]; then
echo "START_MIREDO is set to false in /etc/default/$NAME."
echo "$DAEMON not starting."
exit 0
fi
if [ `uname -s` = Linux ]; then
if [ -e /proc/sys/kernel/modprobe ]; then
`cat /proc/sys/kernel/modprobe` tun 2>/dev/null
`cat /proc/sys/kernel/modprobe` ipv6 2>/dev/null
fi
if [ ! -e /dev/net/tun ]; then
echo "/dev/net/tun does not exist."
echo "$DAEMON cannot be started."
exit 0
fi
elif [ `uname -s` = GNU/kFreeBSD ]; then
if ! kldstat | grep if_tun; then
kldload if_tun
fi
fi
}
check_conf_file() {
# FIXME: should use DAEMON_ARGS as set when the daemon was started
if ! "$CHECKCONF" $DAEMON_ARGS; then
echo "Cannot reload miredo: fix /etc/miredo/$NAME.conf first."
exit 1
fi
}
check_chroot_dir() {
if ! [ -d "/var/run/$NAME" ]; then
mkdir -p "/var/run/$NAME"
chmod 0755 "/var/run/$NAME"
fi
}
case "$1" in
start|force-start)
[ "x$1" = "xforce-start" ] && START_MIREDO=true
check_start
check_chroot_dir
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" --oknodo -- $DAEMON_ARGS
log_end_msg $?
;;
stop|force-stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --pidfile "$PIDFILE" \
--retry 1 --oknodo
log_end_msg $?
;;
reload|force-reload)
check_conf_file
log_daemon_msg "Reloading $DESC" "$NAME"
start-stop-daemon --stop --signal 1 --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON"
log_end_msg $?
;;
restart)
check_start # avoid stopping if would not restart
check_conf_file
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $SCRIPTNAME {start|force-start|stop|force-stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit $?
|