Add a patch to 'halt' that will shutdown all the processes within contexts
authorStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 7 May 2008 18:37:43 +0000 (18:37 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 7 May 2008 18:37:43 +0000 (18:37 +0000)
before everything else.

This is necessary because without this, a node would try to shutdown but hang
indefinitely with error messages like:

    umount: /vservers/<slicename>/proc : device is busy
    umount2: Device or resource busy

and finally:

    INIT : no more processes left in this runlevel

But not actually reboot.  This patch has worked in an alpha env where the
original halt script had failed.

config.planetlab/bootstrapfs.post

index 7105c64..d35618c 100644 (file)
@@ -18,3 +18,18 @@ echo > ${vdir}/etc/sysconfig/crontab
 # Add site_admin account
 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
 
+( cat <<EOF ) | patch -d ${vdir}/etc/init.d/
+--- halt        2007-10-08 19:18:54.000000000 +0000
++++ halt2       2008-05-07 17:52:42.000000000 +0000
+@@ -65,8 +65,10 @@
+ # Kill all processes.
+ [ "\${BASH+bash}" = bash ] && enable kill
+
++action $"Sending all VServers the TERM signal..."  ls -d /proc/virtual/[0-9]* | awk -F '/' '{print \$4}' | xargs -I{} /usr/sbin/vkill -s 15 --xid {} -- 0
+ action $"Sending all processes the TERM signal..." /sbin/killall5 -15
+ sleep 2
++action $"Sending all VServers the KILL signal..."  ls -d /proc/virtual/[0-9]* | awk -F '/' '{print \$4}' | xargs -I{} /usr/sbin/vkill -s 9 --xid {} -- 0
+ action $"Sending all processes the KILL signal..."  /sbin/killall5 -9
+
+ # Write to wtmp file before unmounting /var
+EOF