-
Notifications
You must be signed in to change notification settings - Fork 0
/
lancer_serveur.sh
47 lines (31 loc) · 1.14 KB
/
lancer_serveur.sh
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
echo Bienvenue
echo -e "Voulez-vous:\n \e[31m[1]\e[0m Lancer le programme \n\n \e[31m[2]\e[0m Lancer le programme avec log\n\n \e[31m[3]\e[0m Stopper le programme \n\n \e[31m[4]\e[0m Redémarrer le programme \n\n \e[31m[5]\e[0m Checker si l$
#while true
#do
read -p "-->" reponse
if [ $reponse -eq 1 ]; then
echo "lancement du programme..."
sudo systemctl start verycoolserver.service
echo -e "\e[32mOk\e[0m"
elif [ $reponse -eq 2 ]; then
java -jar VeryCoolServer.jar
elif [ $reponse -eq 3 ]; then
echo "Arrêt du programme..."
sudo systemctl stop verycoolserver.service
echo -e "\e[32mOk\e[0m"
elif [ $reponse -eq 4 ]; then
echo "Redémarrage..."
sudo systemctl restart verycoolserver.service
echo -e "\e[32mOk\e[0m"
elif [ $reponse -eq 5 ]; then
statut=$(systemctl list-units --type=service | grep verycoolserver.service)
if [[ $statut == *"running"* ]]; then
echo -e "\e[32mLe programme tourne!\e[0m"
else
echo -e "Le programme \e[31mn'est pas lancé.\e[0m"
fi
else
echo "autre"
fi
#done