[PC-BSD Commits] r17820 - in pcbsd/current/src-sh/warden: bin linux-installs scripts/backend

svn at pcbsd.org svn at pcbsd.org
Thu Jul 19 12:20:01 PDT 2012


Author: kris
Date: 2012-07-19 19:20:01 +0000 (Thu, 19 Jul 2012)
New Revision: 17820

Modified:
   pcbsd/current/src-sh/warden/bin/warden
   pcbsd/current/src-sh/warden/linux-installs/debian-6-squeeze
   pcbsd/current/src-sh/warden/scripts/backend/stopjail.sh
Log:

Improve the shutdown scripts to make sure we unmount, even if the jail 
was manually stopped



Modified: pcbsd/current/src-sh/warden/bin/warden
===================================================================
--- pcbsd/current/src-sh/warden/bin/warden	2012-07-19 18:38:03 UTC (rev 17819)
+++ pcbsd/current/src-sh/warden/bin/warden	2012-07-19 19:20:01 UTC (rev 17820)
@@ -649,14 +649,6 @@
           fi 
 	  set_warden_metadir
          
-          # Check if this jail is already running
-          ${PROGDIR}/scripts/backend/checkstatus.sh "${IP}"
-          if [ "$?" != "0" ]
-          then
-            echo "ERROR: This jail is already stopped!"
-            exit 1
-          fi
- 
           ${PROGDIR}/scripts/backend/stopjail.sh "${IP}" 
           ;;
 

Modified: pcbsd/current/src-sh/warden/linux-installs/debian-6-squeeze
===================================================================
--- pcbsd/current/src-sh/warden/linux-installs/debian-6-squeeze	2012-07-19 18:38:03 UTC (rev 17819)
+++ pcbsd/current/src-sh/warden/linux-installs/debian-6-squeeze	2012-07-19 19:20:01 UTC (rev 17820)
@@ -25,6 +25,7 @@
 ln -s /bin/true ${jDIR}/sbin/umount
 
 # Setup some custom start / stop stuff
-echo "-l -u root" > ${3}/jail-flags
+echo "/etc/init.d/rc 3" > ${3}/jail-start
+echo "/etc/init.d/rc 0" > ${3}/jail-stop
 
 exit $err

Modified: pcbsd/current/src-sh/warden/scripts/backend/stopjail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/stopjail.sh	2012-07-19 18:38:03 UTC (rev 17819)
+++ pcbsd/current/src-sh/warden/scripts/backend/stopjail.sh	2012-07-19 19:20:01 UTC (rev 17820)
@@ -36,14 +36,6 @@
 
 HOST="`cat ${JMETADIR}/host`"
 
-# Make sure the jail is running
-jls | grep ${JDIR}/${IP} >/dev/null 2>/dev/null
-if [ "$?" != "0" ]
-then
-  echo "ERROR: Jail is not running!"
-  exit 6
-fi
-
 # End of error checking, now shutdown this jail
 ##################################################################
 
@@ -89,13 +81,19 @@
   if [ -e "${JMETADIR}/jail-stop" ] ; then
     sCmd=`cat ${JMETADIR}/jail-stop`
     echo "Stopping jail with: ${sCmd}"
-    jexec ${JID} ${sCmd} 2>&1
+    if [ -n "${JID}" ] ; then
+      jexec ${JID} ${sCmd} 2>&1
+    fi
   else
     # Check for different init styles
     if [ -e "${JDIR}/${IP}/etc/init.d/rc" ] ; then
-      jexec ${JID} /bin/sh /etc/init.d/rc 0 2>&1
+      if [ -n "${JID}" ] ; then
+        jexec ${JID} /bin/sh /etc/init.d/rc 0 2>&1
+      fi
     elif [ -e "${JDIR}/${IP}/etc/rc" ] ; then
-      jexec ${JID} /bin/sh /etc/rc 0 2>&1
+      if [ -n "${JID}" ] ; then
+        jexec ${JID} /bin/sh /etc/rc 0 2>&1
+      fi
     fi
   fi
   sleep 3
@@ -107,12 +105,16 @@
 else
   # If we have a custom stop script
   if [ -e "${JMETADIR}/jail-stop" ] ; then
-    sCmd=`cat ${JMETADIR}/jail-stop`
-    echo "Stopping jail with: ${sCmd}"
-    jexec ${JID} ${sCmd} 2>&1
+    if [ -n "${JID}" ] ; then
+      sCmd=`cat ${JMETADIR}/jail-stop`
+      echo "Stopping jail with: ${sCmd}"
+      jexec ${JID} ${sCmd} 2>&1
+    fi
   else
-    echo "Stopping jail with: /etc/rc.shutdown"
-    jexec ${JID} /bin/sh /etc/rc.shutdown >/dev/null 2>/dev/null
+    if [ -n "${JID}" ] ; then
+      echo "Stopping jail with: /etc/rc.shutdown"
+      jexec ${JID} /bin/sh /etc/rc.shutdown >/dev/null 2>/dev/null
+    fi
   fi
 fi
 
@@ -174,7 +176,9 @@
 
 echo -e ".\c"
 
-jail -r ${JID}
+if [ -n "${JID}" ] ; then
+  jail -r ${JID}
+fi
 
 echo -e "Done"
 



More information about the Commits mailing list