modernize debian init.d script to eliminate warnings

Change-Id: I06a01c82a3f7547d939e5d41de4535f91a423f90
changes/48/9948/6
Richard Fuchs 9 years ago
parent a2391f9490
commit 9e38b8fa94

@ -16,22 +16,17 @@ NAME=ngcp-rtpengine-daemon
DESC="RTP/media proxy" DESC="RTP/media proxy"
TABLE=0 TABLE=0
case $(dirname $0) in DAEMON=$(which rtpengine)
/*) FULLPATH=$(dirname $0);;
*) FULLPATH=$(pwd)/$(dirname $0);;
esac
DAEMON=`which rtpengine`
DEFAULTS=/etc/default/${NAME} DEFAULTS=/etc/default/${NAME}
test -f $DAEMON || exit 0 test -f "$DAEMON" || exit 0
# Load startup options if available # Load startup options if available
if [ -f $DEFAULTS ]; then if [ -f "$DEFAULTS" ]; then
. $DEFAULTS || true . "$DEFAULTS" || true
fi fi
if [ "$RUN_RTPENGINE" != "yes" -a "$RUN_MEDIAPROXY" != "yes" ]; then if [ "$RUN_RTPENGINE" != "yes" ]; then
echo "rtpengine not yet configured. Edit $DEFAULTS first." echo "rtpengine not yet configured. Edit $DEFAULTS first."
exit 0 exit 0
fi fi
@ -137,7 +132,7 @@ case "$1" in
;; ;;
esac esac
fi fi
echo -n "Starting $DESC: $NAME" log_daemon_msg "Starting $DESC: $NAME"
if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then
set +e set +e
modprobe xt_RTPENGINE modprobe xt_RTPENGINE
@ -175,14 +170,14 @@ case "$1" in
fi fi
set -e set -e
fi fi
start-stop-daemon --start --quiet --pidfile $PIDFILE \ start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec $DAEMON -- $OPTIONS || echo -n " already running" --exec "$DAEMON" -- $OPTIONS || log_progress_msg " already running"
log_end_msg $? log_end_msg $?
;; ;;
stop) stop)
echo -n "Stopping $DESC: $NAME" log_daemon_msg "Stopping $DESC: $NAME"
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--exec $DAEMON --exec "$DAEMON"
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
return $? return $?
fi fi
@ -214,9 +209,9 @@ case "$1" in
;; ;;
restart|force-reload) restart|force-reload)
echo -n "Restarting $DESC: $NAME" log_daemon_msg "Restarting $DESC: $NAME"
start-stop-daemon --oknodo --stop --quiet --pidfile \ start-stop-daemon --oknodo --stop --quiet --pidfile \
$PIDFILE --exec $DAEMON "$PIDFILE" --exec $DAEMON
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
return $? return $?
fi fi
@ -226,10 +221,10 @@ case "$1" in
status=$? status=$?
case "${status}" in case "${status}" in
0|3) 0|3)
echo "Active node or transition." log_progress_msg "Active node or transition."
;; ;;
*) *)
echo "Ignored start action in inactive node ($status)" log_progress_msg "Ignored start action in inactive node ($status)"
exit 0 exit 0
;; ;;
esac esac
@ -273,7 +268,7 @@ case "$1" in
set -e set -e
fi fi
start-stop-daemon --start --quiet --pidfile \ start-stop-daemon --start --quiet --pidfile \
$PIDFILE --exec $DAEMON -- $OPTIONS "$PIDFILE" --exec "$DAEMON" -- $OPTIONS
log_end_msg $? log_end_msg $?
;; ;;
status) status)

Loading…
Cancel
Save