summaryrefslogtreecommitdiff
path: root/share/hydractl
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-09 21:17:25 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-09 21:17:25 -0300
commiteeb907c24812123d98598246805b5613cd4b1f8a (patch)
treed75d59c6b611e884a92cc4902c373967e29b640c /share/hydractl
parentaf6a7306d64f04e3beb4ae45eb6320ac7e9b866c (diff)
downloadhydra-eeb907c24812123d98598246805b5613cd4b1f8a.tar.gz
hydra-eeb907c24812123d98598246805b5613cd4b1f8a.tar.bz2
Skip if files already exist at backup-site
Diffstat (limited to 'share/hydractl')
-rwxr-xr-xshare/hydractl/backup-site40
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