diff options
Diffstat (limited to 'share/hydractl/backup-site')
-rwxr-xr-x | share/hydractl/backup-site | 17 |
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 |