- bump version number
[mom.git] / pl_mop.sh
index d80ce64..edc8222 100755 (executable)
--- a/pl_mop.sh
+++ b/pl_mop.sh
@@ -5,7 +5,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2005 The Trustees of Princeton University
 #
-# $Id$
+# $Id: pl_mop.sh,v 1.5 2006/03/06 20:40:33 mlhuang Exp $
 #
 
 PATH=/sbin:/usr/sbin:$PATH
@@ -46,7 +46,7 @@ fix_etc_shadow() {
 
 # keep essential services running
 restart_services() {
-    for service in autofs sshd pl_sshd pl_mom pl_nm pl_conf proper ; do
+    for service in sshd pl_sshd swapmon pl_nm proper ; do
        echo "* Checking $service"
        status=$(service $service status)
        if [ $? -ne 0 ] || echo $status 2>&1 | grep -q stopped ; then
@@ -68,6 +68,17 @@ restart_netflow() {
     fi
 }
 
+# keep pl_conf running
+restart_pl_conf() {
+    echo "* Checking pl_conf"
+    vserver pl_conf exec /sbin/service pl_conf status >/dev/null 2>&1
+    if [ $? -ne 0 ] ; then
+       echo "* Restarting pl_conf"
+       vserver pl_conf stop
+       vserver pl_conf start
+    fi
+}
+
 # kill all the processes running in slice contexts
 vkillall() {
     vps -A | awk '(int($2) > 1) { system("vkill -c " $2 " -s 9 " $1); }'
@@ -98,9 +109,6 @@ fix_vservers() {
     # kill all processes running in slice contexts
     vkillall
 
-    # stop the key automounter
-    service autofs stop
-
     # stop vcached
     pidfile=/var/run/vcached.pid
     if [ -r "$pidfile" ] ; then
@@ -121,17 +129,17 @@ fix_vservers() {
         # blow away the vserver cache
        rm -rf /vservers/.vcache/*
 
-        # re-mount /vservers
-       mount /vservers
+        # XXX re-mount /vservers
+       # mount /vservers
+
+       # shutdown instead to avoid clearing disk quotas
+       shutdown -r now "/vservers filesystem repaired, rebooting"
     else
        echo "Unable to unmount /vservers!" >&2
     fi
 
     # allow vcached to run again
     rm -f $pidfile
-
-    # restart the key automounter
-    service autofs start
 }
 
 kill_duplicate_ssh() {
@@ -168,6 +176,8 @@ run fix_etc_shadow
 
 run restart_services
 
+run restart_pl_conf
+
 run restart_netflow
 
 run kill_duplicate_ssh