Procházet zdrojové kódy

Adding killall script

master
Miguel Gagliardo před 5 měsíci
rodič
revize
7d857dcb67
2 změnil soubory, kde provedl 41 přidání a 0 odebrání
  1. 13
    0
      README.md
  2. 28
    0
      killall.sh

+ 13
- 0
README.md Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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

Načítá se…
Zrušit
Uložit