diff --git a/startup-test.sh b/startup-test.sh new file mode 100644 index 0000000..17568bf --- /dev/null +++ b/startup-test.sh @@ -0,0 +1,41 @@ +#/bin/bash +# Bash script for start up all the programs for SERGE +# All programs are started in the background and in parallel +# All the programs are called with their needed arguments +# Author: Félix MARQUET + +# Démarrer le serveur TCP +echo "Starting the TCP server" +/mnt/win/Users/BreizhHardware/Nextcloud/Programation/C++/Modelec/Initialisation/test/test1.sh & +sleep 1 + +# Démarrer le Lidar +echo "Starting the Lidar" +/mnt/win/Users/BreizhHardware/Nextcloud/Programation/C++/Modelec/Initialisation/test/test2.sh & +sleep 1 + +# Démarrer la caméra +echo "Starting the camera" +/mnt/win/Users/BreizhHardware/Nextcloud/Programation/C++/Modelec/Initialisation/test/test3.sh & + +# Démarrer l'IHM +echo "Starting the IHM" +/mnt/win/Users/BreizhHardware/Nextcloud/Programation/C++/Modelec/Initialisation/test/test4.sh fullscreen & + +# Fonction pour surveiller la fermeture de l'IHM +monitor_ihm() { + while pgrep -x "test4.sh" > /dev/null; do + sleep 1 + done + # Une fois l'IHM fermée, tuer tous les autres programmes + killall test1.sh + killall test2.sh + killall test3.sh + echo "All programs terminated." +} + +# Démarrer la fonction de surveillance en arrière-plan +monitor_ihm & + +# Attendre que tous les programmes se terminent +wait diff --git a/test/test1.sh b/test/test1.sh new file mode 100644 index 0000000..bc3f24b --- /dev/null +++ b/test/test1.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +while true; do + echo "test1" +done \ No newline at end of file diff --git a/test/test2.sh b/test/test2.sh new file mode 100644 index 0000000..933a4f8 --- /dev/null +++ b/test/test2.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +while true; do + echo "test2" +done \ No newline at end of file diff --git a/test/test3.sh b/test/test3.sh new file mode 100644 index 0000000..404fb0c --- /dev/null +++ b/test/test3.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +while true; do + echo "test3" +done \ No newline at end of file diff --git a/test/test4.sh b/test/test4.sh new file mode 100644 index 0000000..c99dff4 --- /dev/null +++ b/test/test4.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Boucle pendant 10 secondes +SECONDS=0 +while [ $SECONDS -lt 2 ]; do + echo "test4" + sleep 1 +done + +# Quitter le programme +exit 0 \ No newline at end of file