Added list for cc'ing Mom messages
[myplc.git] / guest.init
index 0b7e473..e95c34e 100755 (executable)
@@ -6,7 +6,7 @@
 #
 # description: Manages all PLC services on this machine
 #
-# $Id: guest.init 635 2007-07-05 11:08:14Z thierry $
+# $Id$
 #
 
 # Source function library and configuration
@@ -94,6 +94,9 @@ usage()
     echo "     stop            Stop all PLC subsystems"
     echo "     reload          Regenerate configuration files"
     echo "     restart         Restart all PLC subsystems"
+    echo "     checkpoint filename : Checkpoint the current state of MyPLC to filename"
+    echo "     restore filename : Restore MyPLC state from filename"
+    echo "     steps           Displays ordered list of subsystems"
     echo
     echo "Steps:"
     for step in "${steps[@]}" ; do
@@ -187,6 +190,43 @@ case "$command" in
        reload force
        ;;
 
+    checkpoint)
+       cpfile=$1
+       if [ -z "$cpfile" ] ; then
+           echo "PLC: checkpoint requires a filename as an argument"
+           exit 1
+       fi 
+       cpdir=$(mktemp -d tmp.XXXXXX)
+       cd $cpdir
+       mkdir -p ./etc/planetlab/
+       rsync -av /etc/planetlab/ ./etc/planetlab/
+       /etc/plc.d/db checkpoint ./etc/planetlab/plc_db.checkpoint ./etc/planetlab/plc_drupal.checkpoint
+       tar cjf $cpfile etc
+       cd -
+       rm -rf $cpdir
+       ;;
+
+    restore)
+       cpfile=$1
+       cpdir=$(mktemp -d tmp.XXXXXX)
+       cd $cpdir
+       tar xjf $cpfile
+       /etc/plc.d/db restore ./etc/planetlab/plc_db.checkpoint ./etc/planetlab/plc_drupal.checkpoint
+       rm -f ./etc/planetlab/plc_db.checkpoint ./etc/planetlab/plc_drupal.checkpoint
+       rsync -av ./etc/planetlab/ /etc/planetlab/
+       cd -
+       rm -rf $cpdir
+       ;;
+
+    steps)
+       echo "${steps[@]}" >&4
+       ;;
+
+    # for backwards compatibility
+    mount|umount|mountstatus)
+       echo "${command} not used within native myplc environment"
+       ;;
+
     *)
        usage >&3
        ;;