PLC support scripts as part of myplc package.
[myplc.git] / guest.init
index 938a31e..e95c34e 100755 (executable)
@@ -94,6 +94,8 @@ 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:"
@@ -190,11 +192,14 @@ case "$command" in
 
     checkpoint)
        cpfile=$1
-       [ -z "$cpfile" ] && cpfile=/var/tmp/plc_checkpoint.$(date +"%Y-%m-%d-%H-%M-%S")
+       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/
+       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 -
@@ -206,8 +211,9 @@ case "$command" in
        cpdir=$(mktemp -d tmp.XXXXXX)
        cd $cpdir
        tar xjf $cpfile
-       rsync -av ./etc/planetlab/ /etc/planetlab
        /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
        ;;
@@ -216,6 +222,11 @@ case "$command" in
        echo "${steps[@]}" >&4
        ;;
 
+    # for backwards compatibility
+    mount|umount|mountstatus)
+       echo "${command} not used within native myplc environment"
+       ;;
+
     *)
        usage >&3
        ;;