matrix/killall.sh

44 lines
996 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
printf 'WARNING: Will remove everything now. Please confirm: (Y/N) '
read answer
if [ "${answer}" != "${answer#[Yy]}" ] ;then
echo "Stopping services"
systemctl disable --now matrix
systemctl disable --now nginx
systemctl disable --now coturn
echo "Purging containers data"
docker system prune -a -f
echo "Removing packages"
apt remove -y --purge pwgen nginx python3-certbot-nginx coturn* docker*
systemctl daemon-reload
echo "Purging files and directories"
rm -rf \
/etc/nginx \
/etc/turn* \
/etc/default/coturn \
/etc/systemd/system/matrix.service \
/opt/matrix \
/tmp/matrix \
/tmp/homeserver.yaml \
/etc/letsencrypt \
/tmp/*.zip
echo "Uninstalling and disabling firewall rules"
ufw disable
apt remove -y --purge ufw
# Removing User's crontab
crontab -r
echo "Purging finished"
else
echo "KillAll aborted"
fi