Parcourir la source

Adding killall script

master
Miguel Gagliardo il y a 7 mois
Parent
révision
7d857dcb67
2 fichiers modifiés avec 41 ajouts et 0 suppressions
  1. 13
    0
      README.md
  2. 28
    0
      killall.sh

+ 13
- 0
README.md Voir le fichier

@@ -55,3 +55,16 @@ The first user will need to be created via command line interface, this is uniqu
55 55
 ```
56 56
 
57 57
 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)
58
+
59
+
60
+## Cleanup
61
+
62
+To remove everything from the server, just run the `killall.sh` script:
63
+
64
+```shell
65
+% cd /opt/matrix
66
+% ./killall.sh 
67
+WARNING: Will remove everything now. Please confirm: (Y/N) 
68
+```
69
+
70
+Select the option `Y` (yes) and it'll be done

+ 28
- 0
killall.sh Voir le fichier

@@ -0,0 +1,28 @@
1
+#!/bin/bash
2
+
3
+set -euo pipefail
4
+
5
+printf 'WARNING: Will remove everything now. Please confirm: (Y/N) '
6
+read answer
7
+
8
+if [ "${answer}" != "${answer#[Yy]}" ] ;then 
9
+    echo "Stopping services"
10
+    systemctl disable --now matrix
11
+    systemctl disable --now nginx
12
+    systemctl disable --now coturn
13
+
14
+    echo "Purging containers data"
15
+    docker system prune -a -f
16
+
17
+    echo "Purging directories"
18
+    rm -rf /etc/nginx /etc/turn* /etc/default/coturn /etc/systemd/system/matrix.service /opt/matrix /tmp/matrix /tmp/homeserver.yaml
19
+    
20
+    echo "Purging directories"
21
+    apt remove -y --purge pwgen nginx python3-certbot-nginx coturn* docker*
22
+
23
+    systemctl daemon-reload
24
+
25
+    echo "Purging finished"
26
+else
27
+    echo "KillAll aborted"
28
+fi

Chargement…
Annuler
Enregistrer