autocommit
This commit is contained in:
56
scripts/manaage_server.sh
Normal file
56
scripts/manaage_server.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to manage tello-server using supervisorctl
|
||||
|
||||
COMMAND=$1
|
||||
SERVICE_NAME="tello-server"
|
||||
|
||||
function start_service {
|
||||
echo -e "\033[94m[INFO]\033[0m Starting $SERVICE_NAME..."
|
||||
sudo supervisorctl start $SERVICE_NAME
|
||||
}
|
||||
|
||||
function stop_service {
|
||||
echo -e "\033[94m[INFO]\033[0m Stopping $SERVICE_NAME..."
|
||||
sudo supervisorctl stop $SERVICE_NAME
|
||||
}
|
||||
|
||||
function restart_service {
|
||||
echo -e "\033[94m[INFO]\033[0m Restarting $SERVICE_NAME..."
|
||||
sudo supervisorctl restart $SERVICE_NAME
|
||||
}
|
||||
|
||||
function status_service {
|
||||
echo -e "\033[94m[INFO]\033[0m Checking status of $SERVICE_NAME..."
|
||||
sudo supervisorctl status $SERVICE_NAME
|
||||
}
|
||||
|
||||
function update_service {
|
||||
echo -e "\033[94m[INFO]\033[0m Updating $SERVICE_NAME..."
|
||||
sudo supervisorctl reread
|
||||
sudo supervisorctl update
|
||||
sudo supervisorctl restart $SERVICE_NAME
|
||||
}
|
||||
|
||||
case "$COMMAND" in
|
||||
start)
|
||||
start_service
|
||||
;;
|
||||
stop)
|
||||
stop_service
|
||||
;;
|
||||
restart)
|
||||
restart_service
|
||||
;;
|
||||
status)
|
||||
status_service
|
||||
;;
|
||||
update)
|
||||
update_service
|
||||
;;
|
||||
*)
|
||||
echo -e "\033[31m[ERROR]\033[0m Invalid command!"
|
||||
echo "Usage: $0 {start|stop|restart|status|update}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user