Bug#959860: initscripts: Please provide shutdown-equivalent to rc.local
Patrik Schindler
poc at pocnet.net
Wed May 6 10:03:32 BST 2020
Package: initscripts
Version: 2.93-8
Severity: wishlist
Tags: patch
Please integrate this patch to have stuff done at system shutdown.
My reason to use it is a hercules instance in a screen session, started by cron
@reboot for a certain user. Doing this completely in an initscript is hard, but
initiating an orderly shutdown to hercules at the right time is easy.
--- rc.local.orig 2020-05-06 10:50:43.230690277 +0200
+++ rc.local 2020-05-06 10:45:17.252094001 +0200
@@ -24,6 +24,16 @@
fi
}
+do_stop() {
+ if [ -x /etc/rc.local.shutdown ]; then
+ [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
+ /etc/rc.local.shutdown
+ ES=$?
+ [ "$VERBOSE" != no ] && log_end_msg $ES
+ return $ES
+ fi
+}
+
case "$1" in
start)
do_start
@@ -32,10 +42,14 @@
echo "Error: argument '$1' not supported" >&2
exit 3
;;
- stop|status)
+ status)
# No-op
exit 0
;;
+ stop)
+ do_stop
+ exit 0
+ ;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
-- System Information:
Debian Release: 10.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.0-8-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)
Versions of packages initscripts depends on:
ii coreutils 8.30-3
ii debianutils 4.8.6.1
ii lsb-base 10.2019051400
ii mount 2.33.1-0.1
ii sysv-rc 2.93-8
ii sysvinit-utils 2.93-8
Versions of packages initscripts recommends:
ii e2fsprogs 1.44.5-1+deb10u3
ii psmisc 23.2-1
initscripts suggests no packages.
-- Configuration Files:
/etc/default/tmpfs changed [not included]
-- no debconf information
More information about the Debian-init-diversity
mailing list