KILL_PYROS_DOCKER_RUN 1.6 KB
#!/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 exec pyros bash docker/$0 $1
    exit
fi


# to really KILL PYROS:
DOIT=1
# No KILL, just inform
#DOIT=0
[[ $1 == "no" ]] && DOIT=0

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



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

}

# - WEB SERVER
ps_process "pyros.py start webserver"
ps_process "manage.py runserver"

# - 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"