-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
41 lines (33 loc) · 850 Bytes
/
uninstall.sh
File metadata and controls
41 lines (33 loc) · 850 Bytes
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
39
40
41
#!/bin/sh
SERVICE_NAME="rm-event-trigger"
SERVICE_DIR="/etc/systemd/system"
echo "Removing rmEventTrigger service."
echo "Binaries and app folder will be left untouched."
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
echo "Stopping and disabling the service..."
systemctl stop "$SERVICE_NAME.service"
if [ $? -ne 0 ]; then
echo "Failed to stop service."
exit 1
fi
systemctl disable "$SERVICE_NAME.service"
if [ $? -ne 0 ]; then
echo "Failed to disable service."
exit 1
fi
echo "Removing service file..."
rm -f "$SERVICE_DIR/$SERVICE_NAME.service"
if [ $? -ne 0 ]; then
echo "Failed to remove service file."
exit 1
fi
systemctl daemon-reload
if [ $? -ne 0 ]; then
echo "Failed to reload systemd daemon."
exit 1
fi
echo "Uninstallation completed successfully!"
exit 0