aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/backup-site
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-03-06 10:52:20 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-03-06 10:52:20 -0300
commit25452fbec218ab3815095899b7b89599d33b170c (patch)
tree02c391f40fed9974addcda039f086a244a32017d /share/hydractl/backup-site
parent02f51bd3362ecc43944909f3bf7654387b933408 (diff)
downloadhydra-25452fbec218ab3815095899b7b89599d33b170c.tar.gz
hydra-25452fbec218ab3815095899b7b89599d33b170c.tar.bz2
Minor cleanup at backup-site
Diffstat (limited to 'share/hydractl/backup-site')
-rwxr-xr-xshare/hydractl/backup-site17
1 files changed, 9 insertions, 8 deletions
diff --git a/share/hydractl/backup-site b/share/hydractl/backup-site
index 2c448c0..70baf3d 100755
--- a/share/hydractl/backup-site
+++ b/share/hydractl/backup-site
@@ -26,7 +26,8 @@ SITE="$1"
PACK="$1.tar.bz2"
DATE="`date +%Y%m%d`"
DEST_BASE="$SITES/backups"
-DEST="$DEST_BASE/site/$SITE/`facter hostname`/$DATE"
+DEST_BASE_SITE="$DEST_BASE/site/$SITE"
+DEST="$DEST_BASE_SITE/`facter hostname`/$DATE"
# Syntax check.
if [ -z "$SITE" ]; then
@@ -70,18 +71,18 @@ mkdir -p $DEST
cd $DEST
# Password setup
-if [ ! -e "$SITES/backups/site/$SITE/.htpasswd" ]; then
- touch $SITES/backups/site/$SITE/.htpasswd
- chmod 640 $SITES/backups/site/$SITE/.htpasswd
- chown root.$BACKUPS_GROUP $SITES/backups/site/$SITE/.htpasswd
+if [ ! -e "$DEST_BASE_SITE/.htpasswd" ]; then
+ touch $DEST_BASE_SITE/.htpasswd
+ chmod 640 $DEST_BASE_SITE/.htpasswd
+ chown root.$BACKUPS_GROUP $DEST_BASE_SITE/.htpasswd
fi
# Access setup
-if [ ! -e "$SITES/backups/site/$SITE/.htaccess" ]; then
- cat > $SITES/backups/site/$SITE/.htaccess <<-EOF
+if [ ! -e "$DEST_BASE_SITE/.htaccess" ]; then
+ cat > $DEST_BASE_SITE/.htaccess <<-EOF
AuthType Basic
AuthName "Backup $SITE"
-AuthUserFile $SITES/backups/site/$SITE/.htpasswd
+AuthUserFile $DEST_BASE_SITE/.htpasswd
Require valid-user
EOF
fi