Skip to content

Instantly share code, notes, and snippets.

@yogoeasy
Last active November 28, 2018 08:09
Show Gist options
  • Select an option

  • Save yogoeasy/7506344ec5369fb53c458c62fdeb02d2 to your computer and use it in GitHub Desktop.

Select an option

Save yogoeasy/7506344ec5369fb53c458c62fdeb02d2 to your computer and use it in GitHub Desktop.
runcloud-remote-backup
webroot=/home/runcloud/webapps
cd $webroot
for d in *;
do
domaindir=$(basename $d)
[[ $domaindir =~ ^(22222|html|www)$ ]] && continue #自行修改要排除備份上傳的webapps
echo "*******************************"
echo "Transfer files for '$domaindir'"
echo "*******************************"
ls $webroot/"$domaindir"/wp-content && cd $webroot/"$domaindir"/wp-content && wp db export backup.sql --allow-root && rsync -avz --exclude 'updraft' --exclude 'cache' --delete --bwlimit=627 $webroot/"$domaindir" backup:000 && rm $webroot/"$domaindir"/wp-content/*.sql
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment