diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-01-04 14:32:21 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-01-04 14:32:21 -0200 |
commit | f360acf0fab1d941bc7de8bec3d22aabd64f49fe (patch) | |
tree | afd6f8e326996018f0c5fc81cdb2a8a6121df82f /share/hydractl/backup-site | |
parent | 2cfe1c7aad93d666424379b89a27247e570d6e47 (diff) | |
download | hydra-f360acf0fab1d941bc7de8bec3d22aabd64f49fe.tar.gz hydra-f360acf0fab1d941bc7de8bec3d22aabd64f49fe.tar.bz2 |
Enhanced backup restoration
Diffstat (limited to 'share/hydractl/backup-site')
-rwxr-xr-x | share/hydractl/backup-site | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/share/hydractl/backup-site b/share/hydractl/backup-site index dedf0eb..7dd9acf 100755 --- a/share/hydractl/backup-site +++ b/share/hydractl/backup-site @@ -2,7 +2,6 @@ # # Pack a website. # -# TODO: check for backup user/group # Arguments SITES="/var/sites" @@ -17,6 +16,20 @@ if [ -z "$SITE" ]; then exit 1 fi +# Set backups user. +if hydra_check_user backups; then + $BACKUPS_USER="backups" +else + $BACKUPS_USER="root" +fi + +# Set backups group. +if hydra_check_group backups; then + $BACKUPS_GROUP="backups" +else + $BACKUPS_GROUP="root" +fi + # Create folder mkdir -p $DEST cd $DEST @@ -25,7 +38,7 @@ cd $DEST if [ ! -e "$SITES/backups/site/$SITE/.htpasswd" ]; then touch $SITES/backups/site/$SITE/.htpasswd chmod 640 $SITES/backups/site/$SITE/.htpasswd - chown root.backups $SITES/backups/site/$SITE/.htpasswd + chown root.$BACKUPS_GROUP $SITES/backups/site/$SITE/.htpasswd fi # Access setup @@ -44,7 +57,7 @@ if [ -d "$SITES/$SITE" ]; then tar jcvf $PACK $SITES/$SITE md5sum $PACK > $PACK.md5 sha1sum $PACK > $PACK.sha1 - chown root.backups $PACK* + chown root.$BACKUPS_GROUP $PACK* chmod 640 $PACK* echo "Saved $DEST/$PACK" fi @@ -56,7 +69,7 @@ if [ -d "/var/lib/mysql/$SITE" ]; then bzip2 $SITE.sql md5sum $SITE.sql.bz2 > $SITE.sql.bz2.md5 sha1sum $SITE.sql.bz2 > $SITE.sql.bz2.sha1 - chown root.backups $SITE.sql* + chown root.$BACKUPS_GROUP $SITE.sql* chmod 640 $SITE.sql* echo "Saved $DEST/$SITE.sql.bz2" else |