Skip to content

Instantly share code, notes, and snippets.

@gdarko
Created September 4, 2017 10:02
Show Gist options
  • Save gdarko/ca5e8d984c9f825aeaa3e52cd45faa33 to your computer and use it in GitHub Desktop.
Save gdarko/ca5e8d984c9f825aeaa3e52cd45faa33 to your computer and use it in GitHub Desktop.
VestaCP / BackupWordPress simple backup tool
#!/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