mcst-linux-kernel/patches-2024.06.26/mongodb-3.6.13/0006-Change-funcs-from-init...

131 lines
4.2 KiB
Diff

Link:
Subject: replacement of functions from /lib/lsb/init-functions with analogs from /etc/init.d/functions for script work correctly
Bug: 133811
Tags: common
--- a/debian/init.d 2021-07-05 14:36:34.274144799 +0300
+++ b/debian/init.d 2021-07-05 16:34:03.310669274 +0300
@@ -88,7 +88,7 @@
exit 0
fi
-. /lib/lsb/init-functions
+. /etc/rc.d/init.d/functions
STARTTIME=1
DIETIME=10 # Time to wait for the server to die, in seconds
@@ -154,7 +154,7 @@
stop_server() {
# Stop the process using the wrapper
- start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --remove-pidfile \
--retry 300 \
--user $DAEMONUSER \
--exec $DAEMON
@@ -184,11 +184,11 @@
case "$1" in
start)
- log_daemon_msg "Starting $DESC" "$NAME"
+ boot_mesg "Starting $DESC: $NAME" ${NORMAL}
# Check if it's running first
if running ; then
- log_progress_msg "apparently already running"
- log_end_msg 0
+ boot_mesg "apparently already running" ${WARNING}
+ echo_warning
exit 0
fi
if start_server ; then
@@ -198,27 +198,26 @@
[ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
if running ; then
# It's ok, the server started and is running
- log_end_msg 0
+ echo_ok
else
# It is not running after we did start
- log_end_msg 1
+ echo_failure
fi
else
# Either we could not start it
- log_end_msg 1
+ echo_failure
fi
;;
stop)
- log_daemon_msg "Stopping $DESC" "$NAME"
+ boot_mesg "Stopping $DESC: $NAME" ${NORMAL}
if running ; then
# Only stop the server if we see it running
- errcode=0
- stop_server || errcode=$?
- log_end_msg $errcode
+ stop_server
+ evaluate_retval
else
# If it's not running don't do anything
- log_progress_msg "apparently not running"
- log_end_msg 0
+ boot_mesg "apparently not running"
+ echo_warning
exit 0
fi
;;
@@ -227,39 +226,35 @@
$0 stop
if running; then
# If it's still running try to kill it more forcefully
- log_daemon_msg "Stopping (force) $DESC" "$NAME"
- errcode=0
- force_stop || errcode=$?
- log_end_msg $errcode
+ boot_mesg "Stopping (force) $DESC: $NAME" ${NORMAL}
+ force_stop
+ evaluate_retval
fi
;;
restart|force-reload)
- log_daemon_msg "Restarting $DESC" "$NAME"
- errcode=0
- stop_server || errcode=$?
+ boot_mesg "Restarting $DESC: $NAME" ${NORMAL}
+ stop_server
# Wait some sensible amount, some server need this
[ -n "$DIETIME" ] && sleep $DIETIME
- start_server || errcode=$?
+ start_server
[ -n "$STARTTIME" ] && sleep $STARTTIME
- running || errcode=$?
- log_end_msg $errcode
+ running
+ evaluate_retval
;;
status)
- log_daemon_msg "Checking status of $DESC" "$NAME"
+ boot_mesg "Checking status of $DESC: $NAME" ${NORMAL}
if running ; then
- log_progress_msg "running"
- log_end_msg 0
+ echo "running"
else
- log_progress_msg "apparently not running"
- log_end_msg 1
- exit 1
+ echo "apparently not running"
+ exit 3
fi
;;
# MongoDB can't reload its configuration.
reload)
- log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
- log_warning_msg "cannot re-read the config file (use restart)."
+ boot_mesg "Reloading $NAME daemon: not implemented, as the daemon" ${WARNING}
+ boot_mesg "cannot re-read the config file (use restart)." ${WARNING}
;;
*)