Blame view

docker/KILL_PYROS_DOCKER_RUN 1.6 KB
c755b87f   Etienne Pallier   new script PYROS_...
1
#!/usr/bin/env bash
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
2

c755b87f   Etienne Pallier   new script PYROS_...
3
4
5
6
# If Mac OS, execute this script FROM container (then exit !)
OS=$(uname)
#echo $OS
if [[ $OS == "Darwin" ]] ; then
9f9d4174   Etienne Pallier   final simplificat...
7
	#echo "Mac OS"
c755b87f   Etienne Pallier   new script PYROS_...
8
9
10
11
12
13
    docker exec pyros bash docker/$0 $1
    exit
fi


# to really KILL PYROS:
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
14
DOIT=1
c755b87f   Etienne Pallier   new script PYROS_...
15
# No KILL, just inform
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
16
#DOIT=0
c755b87f   Etienne Pallier   new script PYROS_...
17
[[ $1 == "no" ]] && DOIT=0
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
18
19

echo
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
20
21
22
23
echo "VOICI TOUS LES PROCESSUS LANCÉS POUR PYROS"
echo "------------------------------------------"
echo
echo "(Pour tuer complètement pyros, il faut KILL tous ces processus)"
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
24
25
echo

fe603fd1   Alexis Koralewski   test
26

c755b87f   Etienne Pallier   new script PYROS_...
27

a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
28
29
30
ps_process() {

    echo "- Processus $1 :"
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
31
    #ps -efl|grep "$1" | grep -v "grep" | sed "s/ * / /g" | cut -d " " -f 4
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
32
    ps -efl|grep "$1" | grep -v "grep"
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
33
34
    #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)
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
35
    for p in $pids ; do 
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
36
        #[ $DOIT == 1 ] && echo "kill $p"
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
        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"