-
Notifications
You must be signed in to change notification settings - Fork 5
/
uninstall_service.sh
39 lines (32 loc) · 1.07 KB
/
uninstall_service.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
39
#!/usr/bin/env bash
source non_sudo_check.sh
SERVICE_INSTALL_FILE_NAME="asus_wmi_hotkeys_driver.service"
SERVICE_INSTANCE_FILE_NAME="asus_wmi_hotkeys_driver.service"
SERVICE_INSTALL_DIR_PATH="/lib/systemd/system"
sudo systemctl stop "$SERVICE_INSTANCE_FILE_NAME"
if [[ $? != 0 ]]
then
echo "Something went wrong when stopping the $SERVICE_INSTANCE_FILE_NAME"
else
echo "Service $SERVICE_INSTANCE_FILE_NAME stopped"
fi
sudo systemctl disable "$SERVICE_INSTANCE_FILE_NAME"
if [[ $? != 0 ]]
then
echo "Something went wrong when disabling the $SERVICE_INSTANCE_FILE_NAME"
else
echo "Service $SERVICE_INSTANCE_FILE_NAME disabled"
fi
sudo rm -f "$SERVICE_INSTALL_DIR_PATH/$SERVICE_INSTALL_FILE_NAME"
if [[ $? != 0 ]]
then
echo "Something went wrong when removing the $SERVICE_INSTALL_DIR_PATH/$SERVICE_INSTALL_FILE_NAME"
else
echo "Service $SERVICE_INSTALL_DIR_PATH/$SERVICE_INSTALL_FILE_NAME removed"
fi
sudo systemctl daemon-reload
if [[ $? != 0 ]]; then
echo "Something went wrong when was called systemctl daemon reload"
else
echo "Systemctl daemon reloaded"
fi