Adding killall script

This commit is contained in:
Miguel Gagliardo 2024-04-10 18:45:37 +01:00
parent 8162e68ec9
commit 7d857dcb67
2 changed files with 41 additions and 0 deletions

View File

@ -55,3 +55,16 @@ The first user will need to be created via command line interface, this is uniqu
```
From there after, you can just use the admin panel to create users, the admin panel is located in `https://<DOMIN>/admin` (it requires admin user login)
## Cleanup
To remove everything from the server, just run the `killall.sh` script:
```shell
% cd /opt/matrix
% ./killall.sh
WARNING: Will remove everything now. Please confirm: (Y/N)
```
Select the option `Y` (yes) and it'll be done

28
killall.sh Executable file
View File

@ -0,0 +1,28 @@
#!/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 "Purging directories"
rm -rf /etc/nginx /etc/turn* /etc/default/coturn /etc/systemd/system/matrix.service /opt/matrix /tmp/matrix /tmp/homeserver.yaml
echo "Purging directories"
apt remove -y --purge pwgen nginx python3-certbot-nginx coturn* docker*
systemctl daemon-reload
echo "Purging finished"
else
echo "KillAll aborted"
fi