4
# Required-Start: $remote_fs $syslog
5
# Required-Stop: $remote_fs $syslog
6
# Default-Start: 2 3 4 5
10
# Author: Ondřej Surý <ondrej@sury.org>
13
# PATH should only include /usr/* if it runs after the mountnfs.sh script
14
PATH=/sbin:/usr/sbin:/bin:/usr/bin
15
DESC="BIRD Internet Routing Daemon (IPv4)"
17
DAEMON=/usr/sbin/$NAME
19
SCRIPTNAME=/etc/init.d/$NAME
21
# Exit if the package is not installed
22
[ -x "$DAEMON" ] || exit 0
24
# read the RUN variables
27
# Define LSB log_* functions.
28
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
29
. /lib/lsb/init-functions
31
# Create /run/bird with correct permissions
32
/usr/lib/bird/prepare-environment
35
# Function that starts the daemon/service
40
# 0 if daemon has been started
41
# 1 if daemon was already running
42
# 2 if daemon could not be started
43
start-stop-daemon --start --quiet --name $NAME --exec $DAEMON --test > /dev/null \
45
start-stop-daemon --start --quiet --name $NAME --exec $DAEMON -- \
46
-u $BIRD_RUN_USER -g $BIRD_RUN_GROUP $BIRD_ARGS \
48
# Add code here, if necessary, that waits for the process to be ready
49
# to handle requests from services started subsequently which depend
50
# on this one. As a last resort, sleep for some time.
54
# Function that stops the daemon/service
59
# 0 if daemon has been stopped
60
# 1 if daemon was already stopped
61
# 2 if daemon could not be stopped
62
# other if a failure occurred
63
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME --exec $DAEMON
65
[ "$RETVAL" = 2 ] && return 2
66
# Wait for children to finish too if this is a daemon that forks
67
# and if the daemon is only ever run from this initscript.
68
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --name $NAME --exec $DAEMON
69
[ "$?" = 2 ] && return 2
74
# Function that sends a SIGHUP to the daemon/service
78
# If the daemon can reload its configuration without
79
# restarting (for example, when it is sent a SIGHUP),
80
# then implement that here.
82
start-stop-daemon --stop --signal 1 --quiet --name $NAME --exec $DAEMON
88
log_daemon_msg "Starting $DESC" "$NAME"
96
log_daemon_msg "Stopping $DESC" "$NAME"
105
# If do_reload() is not implemented then leave this commented out
106
# and leave 'force-reload' as an alias for 'restart'.
108
log_daemon_msg "Reloading $DESC" "$NAME"
113
log_daemon_msg "Restarting $DESC" "$NAME"
120
1) log_end_msg 1 ;; # Old process is still running
121
*) log_end_msg 1 ;; # Failed to start
131
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2