-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanage-service.sh
More file actions
executable file
·55 lines (52 loc) · 1.76 KB
/
Copy pathmanage-service.sh
File metadata and controls
executable file
·55 lines (52 loc) · 1.76 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
#!/bin/bash
# A Pic a Day Bot Service Manager
# Usage: ./manage-service.sh [start|stop|restart|status|logs|enable|disable]
SERVICE_NAME="a-pic-a-day.service"
case "$1" in
start)
echo "Starting A Pic a Day Bot..."
sudo systemctl start $SERVICE_NAME
;;
stop)
echo "Stopping A Pic a Day Bot..."
sudo systemctl stop $SERVICE_NAME
;;
restart)
echo "Restarting A Pic a Day Bot..."
sudo systemctl restart $SERVICE_NAME
;;
status)
echo "Checking A Pic a Day Bot status..."
sudo systemctl status $SERVICE_NAME
;;
logs)
echo "Showing recent logs..."
sudo journalctl -u $SERVICE_NAME --lines=50 --no-pager
;;
follow-logs)
echo "Following logs (press Ctrl+C to exit)..."
sudo journalctl -u $SERVICE_NAME -f
;;
enable)
echo "Enabling A Pic a Day Bot to start at boot..."
sudo systemctl enable $SERVICE_NAME
;;
disable)
echo "Disabling A Pic a Day Bot from starting at boot..."
sudo systemctl disable $SERVICE_NAME
;;
*)
echo "Usage: $0 {start|stop|restart|status|logs|follow-logs|enable|disable}"
echo ""
echo "Commands:"
echo " start - Start the A Pic a Day Bot service"
echo " stop - Stop the A Pic a Day Bot service"
echo " restart - Restart the A Pic a Day Bot service"
echo " status - Show current status of the service"
echo " logs - Show recent log entries"
echo " follow-logs - Follow log entries in real-time"
echo " enable - Enable service to start at boot"
echo " disable - Disable service from starting at boot"
exit 1
;;
esac