dev-scripts/scripts/debian10/reset-wordpress.sh

20 lines
461 B
Bash
Raw Normal View History

2020-09-07 11:24:58 +00:00
echo "Removing WordPress .."
# check we have ssh access
[ -z "$ssh_user" ] && echo "Error: no user ssh configuration specified" && exit 5
2020-09-07 11:24:58 +00:00
_mysql_cmd="mysql -u$db_user -p$db_pass -e "
ssh -T $ssh_user << EOSSH
2020-09-07 11:24:58 +00:00
# remove database
if command -v mysql ; then
2020-09-08 17:24:06 +00:00
$_mysql_cmd "DROP DATABASE $db_name;"
$_mysql_cmd "CREATE DATABASE $db_name;"
2020-09-07 11:24:58 +00:00
else
2020-09-08 17:24:06 +00:00
echo "ERROR: mysql not found - aborting WordPress removal"
2020-09-07 11:24:58 +00:00
exit 40
fi
# remove files
rm -Rf $wp_path
EOSSH