-
Notifications
You must be signed in to change notification settings - Fork 4
/
uninstall.sh
executable file
·36 lines (26 loc) · 1.07 KB
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
source functions.sh
prompt_text "Enter installation path to delete" "^/.+$" "/srv/vk-to-tgm"
INSTALL_PATH=$ret_val
prompt_text "Enter app's owner" "^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$" "vtt-user"
VTT_USER=$ret_val
echo "Stopping services..."
sudo systemctl stop vtt-cb-receiver vtt-workers vtt-dbc-scheduler vtt-tgm-bot
sudo systemctl disable vtt-cb-receiver vtt-workers vtt-dbc-scheduler vtt-tgm-bot
echo "Deleting service configs..."
sudo rm -f "/etc/systemd/system/vtt-cb-receiver.service" \
"/etc/systemd/system/vtt-workers.service" \
"/etc/systemd/system/vtt-dbc-scheduler.service" \
"/etc/systemd/system/vtt-tgm-bot.service" \
"/etc/default/vtt-workers.conf"
sudo systemctl daemon-reload
echo "Deleting '$INSTALL_PATH'..."
sudo rm -rf "$INSTALL_PATH"
echo "Deleting user '$VTT_USER'..."
sudo userdel "$VTT_USER"
if [ -f /etc/nginx/sites-enabled/vtt-cb-receiver.conf ]; then
echo "Deleting Nginx site config..."
sudo rm /etc/nginx/sites-enabled/vtt-cb-receiver.conf
sudo systemctl reload nginx
fi
echo "Uninstallation completed."