From a1a1861b93cb2463ca830439cd7cea6eb667c885 Mon Sep 17 00:00:00 2001 From: ALIHAN DIKEL Date: Sun, 27 Oct 2024 23:58:55 +0300 Subject: [PATCH] autocommit --- scripts/manaage_server.sh | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 scripts/manaage_server.sh diff --git a/scripts/manaage_server.sh b/scripts/manaage_server.sh new file mode 100644 index 0000000..73932f1 --- /dev/null +++ b/scripts/manaage_server.sh @@ -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