From 1f25194c5ab63ee588fa66f09cf30f5994490455 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 27 Sep 2011 14:45:36 -0300 Subject: Renaming actions and adding backup function --- share/hydractl/backup-site | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 share/hydractl/backup-site (limited to 'share/hydractl/backup-site') diff --git a/share/hydractl/backup-site b/share/hydractl/backup-site new file mode 100755 index 0000000..2d1175b --- /dev/null +++ b/share/hydractl/backup-site @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Pack a website. +# +# TODO: put on $SITES/backups/site/$SITE, with htaccess and correct +# ownership/permission. +# TODO: optionally backup database before packing + +# Arguments +SITES="/var/sites" +SITE="$1" +PACK="$1.tar.bz2" + +if [ -z "$SITE" ]; then + hydra_action_usage + exit 1 +elif [ ! -d "$SITES/$SITE" ]; then + echo "No such site $SITE" + exit 1 +fi + +mkdir -p $SITES/backups/$SITE +cd $SITES/backups/$SITE + +tar jcvf $PACK $SITES/$SITE +md5sum $PACK > $PACK.md5 +sha1sum $PACK > $PACK.sha1 + +echo "Saved $SITES/backups/$SITE/$PACK" -- cgit v1.2.3