-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathservice_manager
executable file
·53 lines (42 loc) · 1.86 KB
/
service_manager
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
#!/bin/bash
if [ "$1" = "install" ]; then
echo "Adding RasDash service to systemctl..."
cat RasDash.service | sudo sed "s@\${DIR}@${PWD}@" - > /etc/systemd/system/RasDash.service
sudo systemctl enable RasDash.service
echo "Done."
elif [ "$1" = "start" ]; then
echo "Starting RasDash service..."
sudo systemctl start RasDash.service
elif [ "$1" = "stop" ]; then
echo "Stopping RasDash service..."
sudo systemctl stop RasDash.service
elif [ "$1" = "restart" ]; then
echo "Restarting RasDash service..."
sudo systemctl restart RasDash.service
elif [ "$1" = "enable" ]; then
echo "Enabling RasDash service to start on boot..."
sudo systemctl enable RasDash.service
elif [ "$1" = "disable" ]; then
echo "Disabling RasDash service from starting on boot..."
sudo systemctl disable RasDash.service
elif [ "$1" = "uninstall" ]; then
echo "Removing RasDash service from systemctl..."
sudo systemctl stop RasDash.service
sudo systemctl disable RasDash.service
sudo rm -f /etc/systemd/system/RasDash.service
sudo systemctl daemon-reload
elif [ "$1" = "help" ]; then
echo ""
echo "./service_manager [option]"
echo ""
echo "install Installs RasDash service and enables start on boot"
echo "start Starts RasDash via systemctl (service must be installed)"
echo "stop Stops RasDash via systemctl (service must be installed)"
echo "restart Restarts RasDash via systemctl (service must be installed)"
echo "enable Enables RasDash to start on boot (service must be installed)"
echo "disable Disables RasDash from starting on boot (service must be installed)"
echo "uninstall Completely removes RasDash service from systemctl"
echo ""
else
echo "Invalid option. Options are help, install, uninstall, enable, disable, start, stop, restart."
fi