dev-scripts/scripts/wordpress/backup.sh

15 lines
494 B
Bash
Raw Normal View History

2020-09-10 09:45:44 +00:00
#!/bin/sh
. ./config
time="$(date +%s)"
[ -n "$1" ] && base_filename="$1-$time" || base_filename="backup-$time"
echo "backing up to $base_filename"
ssh "$remote_ssh" mkdir "/tmp/$base_filename"
2020-09-13 20:05:05 +00:00
ssh "$remote_ssh" tar -czf "/tmp/$base_filename/$base_filename.tar" "$remote_wp_path/wp-content"
2020-09-10 09:45:44 +00:00
wp db export "/tmp/$base_filename/$base_filename.sql" --ssh="$remote_ssh$remote_wp_path" --add-drop-table
scp -r "$remote_ssh:/tmp/$base_filename" . && ssh "$remote_ssh" rm -r "/tmp/$base_filename"