diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-09 16:44:20 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-09 16:44:20 +0000 |
commit | bd5a14836a8967b9ff8b8ed1c14a0b1d8289ea52 (patch) | |
tree | ec801fc9d595e3cf483c564f0d1d9a0f6858ba52 /templates/vserver/vserver.d/etc/rc.d/rc.6 | |
parent | f7595585fae0e0844877ad111388837aaf74028b (diff) | |
download | simplepkg-bd5a14836a8967b9ff8b8ed1c14a0b1d8289ea52.tar.gz simplepkg-bd5a14836a8967b9ff8b8ed1c14a0b1d8289ea52.tar.bz2 |
lots of changes:
- jail-update renamed to jail-commit
- mkjail, jail-commit and templatepkg with svn support
- templates now has permission tracking
- etc
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@164 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'templates/vserver/vserver.d/etc/rc.d/rc.6')
-rwxr-xr-x | templates/vserver/vserver.d/etc/rc.d/rc.6 | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/templates/vserver/vserver.d/etc/rc.d/rc.6 b/templates/vserver/vserver.d/etc/rc.d/rc.6 new file mode 100755 index 0000000..bfec90a --- /dev/null +++ b/templates/vserver/vserver.d/etc/rc.d/rc.6 @@ -0,0 +1,110 @@ +#! /bin/sh +# +# rc.6 This file is executed by init when it goes into runlevel +# 0 (halt) or runlevel 6 (reboot). It kills all processes, +# unmounts file systems and then either halts or reboots. +# +# Version: @(#)/etc/rc.d/rc.6 2.47 Sat Jan 13 13:37:26 PST 2001 +# +# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org> +# Modified by: Patrick J. Volkerding, <volkerdi@slackware.com> +# + +# Set the path. +PATH=/sbin:/etc:/bin:/usr/bin + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Set linefeed mode to avoid staircase effect. +stty onlcr + +echo "Running shutdown script $0:" + +# Find out how we were called. +case "$0" in + *0) + command="halt" + ;; + *6) + command=reboot + ;; + *) + echo "$0: call me as \"rc.0\" or \"rc.6\" please!" + exit 1 + ;; +esac + +# Stop the Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + /etc/rc.d/rc.httpd stop +fi + +# Stop the MySQL database: +if [ -r /var/run/mysql/mysql.pid ]; then + . /etc/rc.d/rc.mysqld stop +fi + +# Stop the Samba server: +if [ -x /etc/rc.d/rc.samba ]; then + . /etc/rc.d/rc.samba stop +fi + +# Try to kill dhcpcd so the DHCP leases can be returned: +killall -15 dhcpcd 1> /dev/null 2> /dev/null + +# Try to shut down pppd: +PS="$(ps ax)" +if echo "$PS" | grep -q -w pppd ; then + if [ -x /usr/sbin/ppp-off ]; then + /usr/sbin/ppp-off + fi +fi + +# Turn off process accounting: +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + echo "Turning off process accounting." + /sbin/accton +fi + +# Kill all processes. +# INIT is supposed to handle this entirely now, but this didn't always +# work correctly without this second pass at killing off the processes. +# Since INIT already notified the user that processes were being killed, +# we'll avoid echoing this info this time around. +if [ "$1" != "fast" ]; then # shutdown did not already kill all processes + killall5 -15 + sleep 5 + killall5 -9 +fi + +# Carry a random seed between reboots. +echo "Saving random seed from /dev/urandom in /etc/random-seed." +# Use the pool size from /proc, or 512 bytes: +if [ -r /proc/sys/kernel/random/poolsize ]; then + dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null +else + dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null +fi +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 + +# This never hurts: +sync + +# sleep 1 fixes problems with some hard drives that don't +# otherwise finish syncing before reboot or poweroff +sleep 1 + +# This is to ensure all processes have completed on SMP machines: +wait + |