-
Notifications
You must be signed in to change notification settings - Fork 4
/
stuck1.sh
44 lines (42 loc) · 1.6 KB
/
stuck1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
source $HOME/.bash_profile
pidList=$(screen -ls | grep "exorde" | awk '/[0-9]{3,}\./ {print strtonum($1)}')
for pid in ${pidList[@]};
do
name=$(screen -ls | grep $pid | awk '{print $1}' | cut -d. -f 2)
truncate -s 0 log.txt
sleep 5
screen -X -S $name hardcopy log.txt
if tail -n5 log.txt | grep 'Init Worker Master' || tail -n2 log.txt | grep 'Claiming Master'
then
echo "Restart worker $name. Worker Stuck";
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
screen -r $name -X stuff $'\003'
sleep 15
screen -r $name -X stuff 'python Launcher.py -m '${mainAddress}' -l 3'`echo -ne '\015'`
else
echo "Worker $name running perfectly";
fi
done