#!/usr/bin/env bash # If Mac OS, execute this script FROM container (then exit !) OS=$(uname) #echo $OS if [[ $OS == "Darwin" ]] ; then #echo "Mac OS" docker compose exec pyros bash docker/$0 $1 exit fi # to really KILL PYROS: DOIT=1 # No KILL, just inform #DOIT=0 [[ $1 == "no" ]] && DOIT=0 # Function ps_process() { echo "- Processus $1 :" #ps -efl|grep "$1" | grep -v "grep" | sed "s/ * / /g" | cut -d " " -f 4 ps -efl|grep "$1" | grep -v "grep" #pids=$(ps -efl|grep "$1" | grep -v "grep" | sed "s/ * / /g" | cut -d " " -f 4) pids=$(ps -efl|grep "$1" | grep -v "grep" | sed "s/ */ /g" | cut -d " " -f 4) for p in $pids ; do #[ $DOIT == 1 ] && echo "kill $p" echo "kill $p" [ $DOIT == 1 ] && kill $p done echo } echo echo "1) Try to STOP pyros cleanly... :" echo "docker compose exec pyros python3 pyros.py stop" echo # ./PYROS stop [ $DOIT == 1 ] && docker compose exec pyros python3 pyros.py stop echo echo echo "2) KILL pyros by force... :" echo echo "VOICI TOUS LES PROCESSUS LANCÉS POUR PYROS" echo "------------------------------------------" echo echo "(Pour tuer complètement pyros, il faut KILL tous ces processus)" echo # - WEB SERVER ps_process "pyros.py start webserver" ps_process "manage.py runserver" ps_process "pyros.py new-start" # - SIMULATORS #ps_process plc ps_process plcSimulator.py ps_process telescope # - AGENT MONITORING #ps_process monitoring ps_process agentM echo echo "VOIR AUSSI LES PROCESSUS DOCKER RESTANT... :" DOIT=0 ps_process docker echo exit # ANCIENNE VERSION ps -efl|grep manage | grep -v "grep" #ps -efl|grep manage | grep -v "grep" | cut -d " " -f 4 ps -efl|grep monitoring | grep -v "grep" #ps -efl|grep start_agent_monitoring | grep -v "grep" #ps -efl|grep start_agent_telescope_monitoring | grep -v "grep" ps -efl|grep plc | grep -v "grep" ps -efl|grep telescope | grep -v "grep"