-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.sh
More file actions
44 lines (41 loc) · 1.05 KB
/
manage.sh
File metadata and controls
44 lines (41 loc) · 1.05 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
#!/bin/bash
SERVICE_NAME="wgerinys.service"
if [ ! $(id -u) -eq 0 ]; then
echo "Insufficient permissions, please run as root (or with sudo)."
exit 1
fi
case "$1" in
start)
systemctl start "$SERVICE_NAME"
;;
stop)
systemctl stop "$SERVICE_NAME"
;;
restart)
systemctl restart "$SERVICE_NAME"
;;
status)
systemctl status "$SERVICE_NAME"
;;
logs)
journalctl -u "$SERVICE_NAME" -f
;;
logs-today)
journalctl -u "$SERVICE_NAME" --since today
;;
update)
echo "Stopping WGErinys..."
systemctl stop "$SERVICE_NAME"
echo "Updating using git..."
git pull
echo "Installing or updating dependencies..."
pip3 install -r requirements.txt
echo "Starting WGErinys..."
systemctl start "$SERVICE_NAME"
echo "Done, the status can be verified with '$0 update'..."
;;
*)
echo "Use: $0 {start|stop|restart|status|logs|logs-today|update}"
exit 1
;;
esac