-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
38 lines (31 loc) · 1.13 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
37
38
#!/bin/bash
# Check if the systemd service is active, and stop it if necessary.
if systemctl is-active --quiet rust-ddns.service; then
echo "Stopping rust-ddns service..."
sudo systemctl stop rust-ddns.service
sudo systemctl disable rust-ddns.service
fi
# Check if the systemd timer is active, and stop it if necessary.
if systemctl is-active --quiet rust-ddns.timer; then
echo "Stopping rust-ddns timer..."
sudo systemctl stop rust-ddns.timer
sudo systemctl disable rust-ddns.timer
fi
# Delete the systemd files.
if [[ -f '/etc/systemd/system/rust-ddns.service' ]]; then
echo "Removing rust-ddns service..."
sudo rm /etc/systemd/system/rust-ddns.service
fi
if [[ -f '/etc/systemd/system/rust-ddns.timer' ]]; then
echo "Removing rust-ddns timer..."
sudo rm /etc/systemd/system/rust-ddns.timer
fi
# Reload the systemd manager configuration.
sudo systemctl daemon-reload
# Delete the symbolic link from the binary folder.
if [[ -L "$HOME/.local/bin/rust-ddns" ]]; then
echo "Deleting symbolic link to rust-ddns..."
rm "$HOME/.local/bin/rust-ddns"
fi
# Confirm uninstallation.
echo "Uninstallation complete!"