add correct runlevel actions to monitor-runlevelagent.ini
authorStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 18 Feb 2009 19:54:21 +0000 (19:54 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 18 Feb 2009 19:54:21 +0000 (19:54 +0000)
minor updates to rla.py

RunlevelAgent.py
monitor-runlevelagent.init

index 49fa631..8ceae8a 100644 (file)
@@ -85,6 +85,7 @@ def main():
     api.AuthCheck()
 
     while True:
+        # TODO: remove from output
         print "reporting status: ", os.popen("uptime").read().strip()
         try:
             # NOTE: alternately, check other stuff in the environment to infer
@@ -102,7 +103,9 @@ def main():
             api.ReportRunlevel({'run_level' : 'safeboot'})
         except:
             traceback.print_exc()
-        time.sleep(30)
+
+               # TODO: change to a configurable value
+        time.sleep(60)
 
 if __name__ == "__main__":
     main()
index f22d587..4923c6d 100644 (file)
@@ -15,6 +15,9 @@
 
 case "$1" in
     start|restart|reload)
+
+               start_rla
+
        ;;
     stop|status)
        exit 0
@@ -25,26 +28,8 @@ case "$1" in
        ;;
 esac
 
-# NOTE: If user already exists, this just exists with status 9.  I think it's
-# ok to simply let this command check and error out.
-# Parse PLC configuration
-if [ -r /etc/planetlab/plc_config ] ; then
-    . /etc/planetlab/plc_config
-else
-    PLC_NAME="PlanetLab"
-    PLC_SLICE_PREFIX="pl"
-    PLC_BOOT_HOST="boot.planet-lab.org"
-fi
-
-USER="${PLC_SLICE_PREFIX}_monitor"
-/usr/sbin/useradd -p "" -m $USER &> /dev/null || : 
-
-if [ ! -d /home/$USER/.ssh ] ; then
-       mkdir /home/$USER/.ssh
-       chmod 700 /home/$USER/.ssh
-       chown $USER.$USER /home/$USER/.ssh
-fi
-
-URL="http://${PLC_BOOT_HOST}/PlanetLabConf/keys.php?$USER"
-curl -s "$URL" > /home/$USER/.ssh/authorized_keys
-chown $USER.$USER /home/$USER/.ssh/authorized_keys
+function start_rla ()
+{
+       RLA=/usr/bin/RunlevelAgent.py
+       $RLA &> /var/log/rla.log &
+}