forked from Ernie3/v4l2-ctl-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice_manager.sh
More file actions
executable file
·46 lines (45 loc) · 1.67 KB
/
Copy pathservice_manager.sh
File metadata and controls
executable file
·46 lines (45 loc) · 1.67 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
#!/bin/bash
if [ "$1" = "install" ]
then
echo "Adding v4l2ctl-api service to systemctl..."
sudo cp v4l2ctl-api.service /etc/systemd/system/v4l2ctl-api.service
sudo systemctl enable v4l2ctl-api.service
echo "Done."
elif [ "$1" = "start" ]
then
echo "Starting v4l2ctl-api service..."
sudo systemctl start v4l2ctl-api.service
elif [ "$1" = "stop" ]
then
echo "Stopping v4l2ctl-api service..."
sudo systemctl stop v4l2ctl-api.service
elif [ "$1" = "enable" ]
then
echo "Enabling v4l2ctl-api service to start on boot..."
sudo systemctl enable v4l2ctl-api.service
elif [ "$1" = "disable" ]
then
echo "Disabling v4l2ctl-api service from starting on boot..."
sudo systemctl disable v4l2ctl-api.service
elif [ "$1" = "uninstall" ]
then
echo "Removing v4l2ctl-api service from systemctl..."
sudo systemctl stop v4l2ctl-api.service
sudo systemctl disable v4l2ctl-api.service
sudo rm -f /etc/systemd/system/v4l2ctl-api.service
sudo systemctl daemon-reload
elif [ "$1" = "help" ]
then
echo ""
echo "./service_manager.sh argument"
echo ""
echo "install - installs v4l2ctl-api service and enables start on boot"
echo "start - starts v4l2ctl-api via systemctl (service must be installed)"
echo "stop - stops v4l2ctl-api via systemctl (service must be installed)"
echo "enable - enables v4l2ctl-api to start on boot (service must be installed)"
echo "disable - disables v4l2ctl-api from starting on boot (service must be installed)"
echo "uninstall - completely removes v4l2ctl-api service from systemctl"
echo ""
else
echo "Invalid option. Options are help, install, uninstall, enable, disable, start, stop."
fi