Created
September 4, 2017 10:02
-
-
Save gdarko/ca5e8d984c9f825aeaa3e52cd45faa33 to your computer and use it in GitHub Desktop.
VestaCP / BackupWordPress simple backup tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
site=$1 | |
absdir=`pwd` | |
fulldir="$absdir/$site/public_html/wp-content/backupwordpress*backups" | |
pubdir="$absdir/$site/public_html" | |
echo "Running backup" | |
echo $fulldir | |
if [ ! -d $fulldir ] | |
then | |
echo "no backup found" | |
exit | |
else | |
start=1 | |
files=`ls $fulldir/*complete*.zip` | |
for i in $files; do | |
if [ -f "$pubdir/b$start.zip" ] | |
then | |
rm "$pubdir/b$start.zip" | |
fi | |
cp "$i" "$pubdir/b$start.zip" | |
echo "Backup created: $site/b$start.zip from $i" | |
start=$(($start+1)) | |
done | |
echo 'Done' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment