summaryrefslogtreecommitdiff
path: root/source/a/sysvinit-scripts/scripts/rc.6
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2016-06-30 20:26:57 +0000
committerEric Hameleers <alien@slackware.com>2018-05-31 23:31:18 +0200
commitd31c50870d0bee042ce660e445c9294a59a3a65b (patch)
tree6bfc0de3c95267b401b620c2c67859557dc60f97 /source/a/sysvinit-scripts/scripts/rc.6
parent76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (diff)
downloadcurrent-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.gz
Slackware 14.2slackware-14.2
Thu Jun 30 20:26:57 UTC 2016 Slackware 14.2 x86_64 stable is released! The long development cycle (the Linux community has lately been living in "interesting times", as they say) is finally behind us, and we're proud to announce the release of Slackware 14.2. The new release brings many updates and modern tools, has switched from udev to eudev (no systemd), and adds well over a hundred new packages to the system. Thanks to the team, the upstream developers, the dedicated Slackware community, and everyone else who pitched in to help make this release a reality. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Have fun! :-)
Diffstat (limited to 'source/a/sysvinit-scripts/scripts/rc.6')
-rw-r--r--source/a/sysvinit-scripts/scripts/rc.655
1 files changed, 35 insertions, 20 deletions
diff --git a/source/a/sysvinit-scripts/scripts/rc.6 b/source/a/sysvinit-scripts/scripts/rc.6
index 8288128c..76895aca 100644
--- a/source/a/sysvinit-scripts/scripts/rc.6
+++ b/source/a/sysvinit-scripts/scripts/rc.6
@@ -26,10 +26,10 @@ echo "Running shutdown script $0:"
# Find out how we were called.
case "$0" in
*0)
- command="halt"
+ shutdown_command="halt"
;;
*6)
- command=reboot
+ shutdown_command=reboot
;;
*)
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
@@ -38,18 +38,32 @@ case "$0" in
esac
# Save the system time to the hardware clock using hwclock --systohc.
+# This will also create or update the timestamps in /etc/adjtime.
if [ -x /sbin/hwclock ]; then
# Check for a broken motherboard RTC clock (where ioports for rtc are
# unknown) to prevent hwclock causing a hang:
- if ! grep -q -w rtc /proc/ioports ; then
+ if ! grep -q " : rtc" /proc/ioports ; then
CLOCK_OPT="--directisa"
fi
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
+ if [ /etc/adjtime -nt /etc/hardwareclock ]; then
+ if grep -q "^LOCAL" /etc/adjtime ; then
+ echo "Saving system time to the hardware clock (localtime)."
+ else
+ echo "Saving system time to the hardware clock (UTC)."
+ fi
+ /sbin/hwclock $CLOCK_OPT --systohc
+ elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
echo "Saving system time to the hardware clock (UTC)."
+ if [ ! -r /etc/adjtime ]; then
+ echo "Creating system time correction file /etc/adjtime."
+ fi
/sbin/hwclock $CLOCK_OPT --utc --systohc
else
echo "Saving system time to the hardware clock (localtime)."
- /sbin/hwclock $CLOCK_OPT --localtime --systohc
+ if [ ! -r /etc/adjtime ]; then
+ echo "Creating system time correction file /etc/adjtime."
+ fi
+ /sbin/hwclock $CLOCK_OPT --localtime --systohc
fi
fi
@@ -101,7 +115,7 @@ fi
# Kill any processes (typically gam) that would otherwise prevent
# unmounting NFS volumes:
unset FUSER_DELAY
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do
+for dir in $(/bin/mount | grep 'type nfs ' | cut -d ' ' -f 3 ) ; do
echo "Killing processes holding NFS mount $dir open..."
# Background this to prevent fuser from also blocking shutdown:
/usr/bin/fuser -k -m $dir &
@@ -113,8 +127,8 @@ if [ ! -z "$FUSER_DELAY" ]; then
fi
# Unmount any NFS, SMB, or CIFS filesystems:
-echo "Unmounting remote filesystems."
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
+echo "Unmounting remote filesystems:"
+/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
# Try to shut down pppd:
PS="$(ps ax)"
@@ -171,12 +185,13 @@ if [ -x /etc/rc.d/rc.udev ]; then
fi
# Kill all remaining processes.
+OMITPIDS="$(for p in $(pgrep mdmon); do echo -o $p; done)" # Don't kill mdmon
if [ ! "$1" = "fast" ]; then
echo "Sending all processes the SIGTERM signal."
- /sbin/killall5 -15
+ /sbin/killall5 -15 $OMITPIDS
/bin/sleep 5
echo "Sending all processes the SIGKILL signal."
- /sbin/killall5 -9
+ /sbin/killall5 -9 $OMITPIDS
fi
# Try to turn off quota.
@@ -198,22 +213,22 @@ fi
/bin/chmod 600 /etc/random-seed
# Before unmounting file systems write a reboot or halt record to wtmp.
-$command -w
-
-# Clear /var/lock/subsys.
-if [ -d /var/lock/subsys ]; then
- rm -f /var/lock/subsys/*
-fi
+$shutdown_command -w
# Turn off swap:
echo "Turning off swap."
/sbin/swapoff -a
/bin/sync
-echo "Unmounting local file systems."
-/bin/umount -v -a -t no,proc,sysfs
+# Stop cgmanager and cgproxy:
+if [ -x /etc/rc.d/rc.cgmanager ]; then
+ sh /etc/rc.d/rc.cgmanager stop
+fi
+
+echo "Unmounting local file systems:"
+/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null
-echo "Remounting root filesystem read-only."
+echo "Remounting root filesystem read-only:"
/bin/mount -v -n -o remount,ro /
# This never hurts:
@@ -275,7 +290,7 @@ if [ -x /sbin/genpowerd ]; then
fi
# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
-if [ "$command" = "reboot" ]; then
+if [ "$shutdown_command" = "reboot" ]; then
echo "Rebooting."
/sbin/reboot
else