initng/trunk/shutdown_script

glen cvs at pld-linux.org
Sun Feb 26 15:04:03 CET 2006


Author: glen
Date: Sun Feb 26 15:04:01 2006
New Revision: 7027

Modified:
   initng/trunk/shutdown_script
Log:
- call rc-scripts shutdown to unmount devices properly

Modified: initng/trunk/shutdown_script
==============================================================================
--- initng/trunk/shutdown_script	(original)
+++ initng/trunk/shutdown_script	Sun Feb 26 15:04:01 2006
@@ -1,6 +1,10 @@
 #!/bin/sh
 case "$1" in
-halt|reboot|poweroff)
+halt|poweroff)
+	runlevel=0
+	;;
+reboot)
+	runlevel=6
 	;;
 *)
 	echo "Have to use $0 [reboot|halt|poweroff]"
@@ -8,19 +12,12 @@
 	;;
 esac
 
-# Set the path.
-PATH=/sbin:/bin:/usr/bin:/usr/sbin
-
-# move to root dir
-cd /
-
-. /etc/rc.d/init.d/functions
-
-run_cmd "Sending all processes the TERM signal" killall5 -15
-run_cmd "Sending all processes the KILL signal" killall5 -9
-
-[ -x /etc/rc.d/rc.acct ] && /etc/rc.d/rc.acct stop
-
-show "The system is halted"; ok
+action="$1"
 
-exec /sbin/system_off "$1"
+# this will emulate runlevel for rc-scripts
+set -- $runlevel unknown
+. /etc/rc.d/rc.shutdown
+
+# as we passed previous runlevel as unknown to rc-scripts,
+# we can reboot/shutdown/poweroff ourself.
+exec /sbin/system_off "$action"


More information about the pld-cvs-commit mailing list