matrix/killall.sh

44 lines
996 B
Bash
Raw Permalink Normal View History

2024-04-10 17:45:37 +00:00
#!/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
2024-04-25 07:11:56 +00:00
echo "Removing packages"
2024-04-10 17:45:37 +00:00
apt remove -y --purge pwgen nginx python3-certbot-nginx coturn* docker*
systemctl daemon-reload
2024-04-25 07:11:56 +00:00
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
2024-04-25 07:21:01 +00:00
# Removing User's crontab
crontab -r
2024-04-10 17:45:37 +00:00
echo "Purging finished"
else
echo "KillAll aborted"
fi