-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove.sh
More file actions
executable file
·63 lines (53 loc) · 1.14 KB
/
remove.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.14 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#/usr/bin/sh
SVCNAME='boot-notify'
SVCPATH1='/etc/systemd/system/boot-notify.service'
SVCPATH2='/usr/lib/systemd/system/boot-notify.service'
NOTIFY_INI="$PWD/src/BotSettings.ini"
# Remove INI if exists
if [ -f "$NOTIFY_INI" ]; then
echo Removing $NOTIFY_INI ...
rm $NOTIFY_INI
echo Removed $NOTIFY_INI
echo
fi
echo Removing $SVCNAME service ...
# Stop the service
if systemctl stop boot-notify.service; then
echo Stopped $SVCNAME
else
echo Error stopping $SVCNAME
exit
fi
# Disable the service
if systemctl disable boot-notify.service; then
echo Disabled $SVCNAME
else
echo Error disabling $SVCNAME
exit
fi
# Remove service
if [ -f $SVCPATH1 ]; then
rm $SVCPATH1
echo Removed $SVCPATH1
fi
# Remove service
if [ -f $SVCPATH2 ]; then
rm $SVCPATH2
echo Removed $SVCPATH2
fi
# Reload changed unit files
if systemctl daemon-reload; then
echo Reloaded changed unit files
else
echo Failed to reload changed unit files
exit
fi
# Reset any units from a failed state
if systemctl reset-failed; then
echo Reset units in failed state
else
echo Failed to reset units in a failed state
exit
fi
echo
echo Successfully removed $SVCNAME!