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