mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
54 lines
1 KiB
Text
54 lines
1 KiB
Text
|
#!/bin/sh
|
||
|
#
|
||
|
# /etc/rc.shutdown
|
||
|
. /etc/rc.conf
|
||
|
. /etc/rc.d/functions
|
||
|
|
||
|
# avoid staircase effect
|
||
|
/bin/stty onlcr
|
||
|
|
||
|
echo "Shutting Down ..."
|
||
|
|
||
|
# Shutdown daemons
|
||
|
let i=${#DAEMONS[@]}
|
||
|
while [[ i -ge 0 ]]; do
|
||
|
if [[ `echo ${DAEMONS[$i]} | grep '^[^\!]' | wc -l` -eq 1 ]]; then
|
||
|
/etc/rc.d/${DAEMONS[$i]#@} stop
|
||
|
fi
|
||
|
let i=i-1
|
||
|
done
|
||
|
# find any leftover daemons and shut them down
|
||
|
if [ -d /var/run/daemons ]; then
|
||
|
for daemon in `ls /var/run/daemons`; do
|
||
|
/etc/rc.d/$daemon stop
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
# removing psmouse module to fix some reboot issues on newer laptops
|
||
|
modprobe -r psmouse >/dev/null 2>&1
|
||
|
|
||
|
# Terminate all processes
|
||
|
echo "Sending SIGTERM To Processes ..."
|
||
|
/sbin/killall5 -15 &> /dev/null
|
||
|
/bin/sleep 5
|
||
|
|
||
|
echo "Sending SIGKILL To Processes ..."
|
||
|
/sbin/killall5 -9 &> /dev/null
|
||
|
|
||
|
echo "Deactivating Swap ..."
|
||
|
/sbin/swapoff -a
|
||
|
|
||
|
echo "Unmounting Filesystems ..."
|
||
|
/bin/umount -a
|
||
|
|
||
|
# Power off or reboot
|
||
|
if [ "$RUNLEVEL" = "0" ]; then
|
||
|
echo "[ POWER OFF ]"
|
||
|
/sbin/poweroff -d -f -i
|
||
|
else
|
||
|
echo " [ REBOOTING ]"
|
||
|
/sbin/reboot -d -f -i
|
||
|
fi
|
||
|
|
||
|
# End of file
|