-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCleanup.sh
32 lines (24 loc) · 889 Bytes
/
Cleanup.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
#!/bin/bash
echo "Cleaning up the services created"
SERVICES=("gost4torrent.service" "frp4torrent.service")
for SERVICE in "${SERVICES[@]}"; do
echo "Stopping the $SERVICE service..."
echo "executing systemctl stop $SERVICE"
sudo systemctl stop "$SERVICE"
echo "Removing the $SERVICE service file..."
echo "executing rm -f /etc/systemd/system/$SERVICE"
sudo rm -f "/etc/systemd/system/$SERVICE"
done
for SERVICE in "${SERVICES[@]}"; do
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
sudo systemctl reset-failed
echo "Validating whether cleanup is complete for $SERVICE..."
if systemctl list-units --type=service | grep -q "$SERVICE"; then
echo "Error: $SERVICE service still exists."
exit 1
else
echo "$SERVICE service has been removed successfully."
fi
done
echo "Cleaning up complete!"