| 1 |
#!/bin/sh |
| 2 |
# -------------------------------------------------------------------------- |
| 3 |
# |
| 4 |
# //===// //===== //===// // // //===// |
| 5 |
# // // // // // // // // // |
| 6 |
# //===// //===== //===// // // //===<< |
| 7 |
# // \\ // // // // // // |
| 8 |
# // \\ =====// // //===== // //===// Version III |
| 9 |
# |
| 10 |
# ------------- An Efficient RSerPool Prototype Implementation ------------- |
| 11 |
# |
| 12 |
# Copyright (C) 2002-2026 by Thomas Dreibholz |
| 13 |
# |
| 14 |
# This program is free software: you can redistribute it and/or modify |
| 15 |
# it under the terms of the GNU General Public License as published by |
| 16 |
# the Free Software Foundation, either version 3 of the License, or |
| 17 |
# (at your option) any later version. |
| 18 |
# |
| 19 |
# This program is distributed in the hope that it will be useful, |
| 20 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
# GNU General Public License for more details. |
| 23 |
# |
| 24 |
# You should have received a copy of the GNU General Public License |
| 25 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 26 |
# |
| 27 |
# Contact: [email protected] |
| 28 |
# |
| 29 |
|
| 30 |
### BEGIN INIT INFO |
| 31 |
# Provides: rsplib-registrar |
| 32 |
# Required-Start: $local_fs $remote_fs $network $syslog |
| 33 |
# Required-Stop: $local_fs $remote_fs $network $syslog |
| 34 |
# Default-Start: 2 3 4 5 |
| 35 |
# Default-Stop: 0 1 6 |
| 36 |
# Short-Description: RSerPool Registrar |
| 37 |
# Description: This service provides a RSerPool Registrar. |
| 38 |
### END INIT INFO |
| 39 |
|
| 40 |
|
| 41 |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
| 42 |
NAME=rspregistrar |
| 43 |
DESC="RSerPool Registrar" |
| 44 |
PIDFILE=/var/run/$NAME.pid |
| 45 |
DAEMON=/usr/bin/rspregistrar |
| 46 |
DAEMON_ARGS="-quiet -daemonpidfile=$PIDFILE -logfile=/var/log/$NAME.log -loglevel=3 -logcolor=off" |
| 47 |
|
| 48 |
test -x $DAEMON || exit 0 |
| 49 |
|
| 50 |
|
| 51 |
# Make sure that SCTP is available |
| 52 |
modprobe sctp > /dev/null 2>&1 |
| 53 |
# sysctl net.sctp.addip_enable=1 |
| 54 |
# sysctl net.sctp.auth_enable=1 |
| 55 |
|
| 56 |
|
| 57 |
# Include rsplib defaults if available |
| 58 |
if [ -f /etc/default/rsplib-registrar ] ; then |
| 59 |
. /etc/default/rsplib-registrar |
| 60 |
fi |
| 61 |
|
| 62 |
# Load the VERBOSE setting and other rcS variables |
| 63 |
. /lib/init/vars.sh |
| 64 |
|
| 65 |
# Define LSB log_* functions. |
| 66 |
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present |
| 67 |
# and status_of_proc is working. |
| 68 |
. /lib/lsb/init-functions |
| 69 |
|
| 70 |
|
| 71 |
set -e |
| 72 |
|
| 73 |
case "$1" in |
| 74 |
start) |
| 75 |
echo -n "Starting $DESC: " |
| 76 |
start-stop-daemon --start --pidfile $PIDFILE \ |
| 77 |
--exec $DAEMON -- $DAEMON_ARGS |
| 78 |
echo "$NAME." |
| 79 |
;; |
| 80 |
stop) |
| 81 |
echo -n "Stopping $DESC: " |
| 82 |
start-stop-daemon --stop --quiet --pidfile $PIDFILE \ |
| 83 |
--exec $DAEMON |
| 84 |
echo "$NAME." |
| 85 |
;; |
| 86 |
force-reload) |
| 87 |
start-stop-daemon --stop --test --quiet --pidfile \ |
| 88 |
$PIDFILE --exec $DAEMON \ |
| 89 |
; $0 restart \ |
| 90 |
|| exit 0 |
| 91 |
;; |
| 92 |
restart) |
| 93 |
echo -n "Restarting $DESC: " |
| 94 |
start-stop-daemon --stop --quiet --pidfile \ |
| 95 |
$PIDFILE --exec $DAEMON || true |
| 96 |
sleep 1 |
| 97 |
start-stop-daemon --start --quiet --pidfile \ |
| 98 |
$PIDFILE --exec $DAEMON -- $DAEMON_ARGS |
| 99 |
echo "$NAME." |
| 100 |
;; |
| 101 |
status) |
| 102 |
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $? |
| 103 |
;; |
| 104 |
*) |
| 105 |
N=/etc/init.d/$NAME |
| 106 |
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 |
| 107 |
exit 1 |
| 108 |
;; |
| 109 |
esac |
| 110 |
|
| 111 |
exit 0 |