diff options
-rwxr-xr-x | share/hydractl/backup-site | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/share/hydractl/backup-site b/share/hydractl/backup-site index 817554a..68b2e4c 100755 --- a/share/hydractl/backup-site +++ b/share/hydractl/backup-site @@ -102,24 +102,32 @@ fi # Backup site if [ -d "$LOCATION" ]; then - echo "Backing up site folder..." - tar jcvf $PACK $LOCATION - md5sum $PACK > $PACK.md5 - sha1sum $PACK > $PACK.sha1 - chown root.$BACKUPS_GROUP $PACK* - chmod 640 $PACK* - echo "Saved $DEST/$PACK" + if [ -e "$PACK" ]; then + echo "File $PACK already exists, skipping..." + else + echo "Backing up site folder..." + tar jcvf $PACK $LOCATION + md5sum $PACK > $PACK.md5 + sha1sum $PACK > $PACK.sha1 + chown root.$BACKUPS_GROUP $PACK* + chmod 640 $PACK* + echo "Saved $DEST/$PACK" + fi fi # Backup database if [ -d "/var/lib/mysql/$SITE" ]; then - echo "Backing up database $SITE..." - mysqldump $SITE > $SITE.sql - bzip2 $SITE.sql - rm -f $SITE.sql - md5sum $SITE.sql.bz2 > $SITE.sql.bz2.md5 - sha1sum $SITE.sql.bz2 > $SITE.sql.bz2.sha1 - chown root.$BACKUPS_GROUP $SITE.sql* - chmod 640 $SITE.sql* - echo "Saved $DEST/$SITE.sql.bz2" + if [ -e "$SITE.sql.bz2" ]; then + echo "File $SITE.sql.bz2 already exists, skipping..." + else + echo "Backing up database $SITE..." + mysqldump $SITE > $SITE.sql + bzip2 $SITE.sql + rm -f $SITE.sql + md5sum $SITE.sql.bz2 > $SITE.sql.bz2.md5 + sha1sum $SITE.sql.bz2 > $SITE.sql.bz2.sha1 + chown root.$BACKUPS_GROUP $SITE.sql* + chmod 640 $SITE.sql* + echo "Saved $DEST/$SITE.sql.bz2" + fi fi |