Blame view

docker/KILL_PYROS_DOCKER_RUN 1.89 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
ec3825e9   Etienne Pallier   update kill
7
    #echo "Mac OS"
23a61124   Alexis Koralewski   Change obsconfig ...
8
    docker compose exec pyros bash docker/$0 $1
c755b87f   Etienne Pallier   new script PYROS_...
9
10
11
12
13
    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

c755b87f   Etienne Pallier   new script PYROS_...
19

ec3825e9   Etienne Pallier   update kill
20
# Function
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
21
ps_process() {
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
22
    echo "- Processus $1 :"
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
23
    #ps -efl|grep "$1" | grep -v "grep" | sed "s/ * / /g" | cut -d " " -f 4
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
24
    ps -efl|grep "$1" | grep -v "grep"
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
25
26
    #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_...
27
    for p in $pids ; do 
bd061de2   Etienne Pallier   bugfix KILL_PYROS...
28
        #[ $DOIT == 1 ] && echo "kill $p"
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
29
30
31
32
        echo "kill $p"
        [ $DOIT == 1 ] && kill $p
    done
    echo
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
33
34
}

ec3825e9   Etienne Pallier   update kill
35
36
37
38


echo
echo "1) Try to STOP pyros cleanly... :"
23a61124   Alexis Koralewski   Change obsconfig ...
39
echo "docker compose exec pyros python3 pyros.py stop"
ec3825e9   Etienne Pallier   update kill
40
41
echo
# ./PYROS stop
23a61124   Alexis Koralewski   Change obsconfig ...
42
[ $DOIT == 1 ] && docker compose exec pyros python3 pyros.py stop
ec3825e9   Etienne Pallier   update kill
43
44
45
46
47
48
49
50
51
52
53
54
55


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


a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
56
57
58
# - WEB SERVER
ps_process "pyros.py start webserver"
ps_process "manage.py runserver"
36583682   Etienne Pallier   updated KILL_PYRO...
59
60
ps_process "pyros.py new-start"

a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

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