automate dated backups of /etc/planetlab
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 29 Jun 2011 09:56:03 +0000 (11:56 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 29 Jun 2011 09:56:03 +0000 (11:56 +0200)
scripts/snapshot-etc-planetlab.sh [new file with mode: 0755]

diff --git a/scripts/snapshot-etc-planetlab.sh b/scripts/snapshot-etc-planetlab.sh
new file mode 100755 (executable)
index 0000000..f741683
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+date=$(date +%Y-%m-%d-%H-%M)
+output=/root/etc-planetlab-snapshots/$date
+
+# mention the first arg if provided in the resulting filename
+[[ -n "$1" ]] && { message=$1 ; shift ; output="${output}-${message}" ; }
+
+[ -d $output ] && { echo "refusing to use pre-existing target dir $output" ; exit 1 ; }
+
+mkdir $output
+
+tar -C /etc/planetlab -cf - . | tar -C $output -xf -
+
+
+
+