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

20 lines
461 B
Bash

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