verificar-servicos.sh
907 Bytes
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
#!/bin/bash
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
if $(service gearmand status | grep -qv "running") ; then
service gearmand start;
LOG="Servico gearman foi iniciado"
fi
if $(service supervisord status | grep -qv "running") ; then
service supervisord start;
LOG="Servico supervisor foi iniciado"
else
COMMAND=$(ps -C php -f | grep -o "PendenciasTramiteRN.php");
if [ -z "$COMMAND" ]
then
service supervisord restart;
LOG="Servico supervisor foi reiniciado"
fi
COMMAND=$(ps -C php -f | grep -o "ProcessarPendenciasRN.php");
if [ -z "$COMMAND" ]
then
service supervisord restart;
LOG="Servico supervisor foi reiniciado"
fi
fi
if [ -n "$LOG" ]
then
#/usr/bin/php console.php log --msg="$LOG" > /dev/null
echo $LOG
fi