2020-03-08 15:29:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-03-08 23:14:07 +00:00
|
|
|
if [ -z "$1" ] ; then
|
|
|
|
_target_filename='.'
|
|
|
|
else
|
|
|
|
_target_filename="$1"
|
2020-03-08 15:29:59 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-08 23:14:07 +00:00
|
|
|
_host="$_local_hostname.$_local_domain"
|
2020-03-08 15:29:59 +00:00
|
|
|
_cmd_wp_export="wp db export --dbuser=wordpress --dbpass=$_wp_db_passwd --add-drop-table data.sql"
|
|
|
|
_ssh_cmd="sshpass -p$_passwd_www ssh $_user_www@$_host"
|
|
|
|
_scp_cmd="sshpass -p$_passwd_www scp $_user_www@$_host:/tmp/wordpress.tar.gz"
|
|
|
|
|
2020-03-09 20:45:35 +00:00
|
|
|
echo "Exporting data ..."
|
2020-03-08 15:29:59 +00:00
|
|
|
$_ssh_cmd "cd /var/www/html/wordpress &&" $_cmd_wp_export
|
|
|
|
$_ssh_cmd 'cd /var/www/html/wordpress && tar czf /tmp/wordpress.tar.gz .'
|
|
|
|
$_ssh_cmd "rm /var/www/html/wordpress/data.sql"
|
2020-03-08 23:14:07 +00:00
|
|
|
$_scp_cmd "$_target_filename"
|
2020-03-08 15:29:59 +00:00
|
|
|
$_ssh_cmd 'rm /tmp/wordpress.tar.gz'
|