Commit 68316ec404d3159fdd94a34c47ef8b9ae4ba191d

Authored by Robert Lopes
1 parent deeeb0bb
Exists in supervisordRH7

Adptado script para gerenciador de servico systemctl, correcao variaveis

de log supervisord.conf
README.md
... ... @@ -79,11 +79,9 @@ Estes dois componentes são utilizados para gerenciar a fila de recebimento de n
79 79 edutorestart=true
80 80 startsecs=15
81 81 startretries=3
82   - log_stdout=true
83   - log_stderr=true
84   - logfile=/var/log/supervisor/sei_processar_pendencias.log
85   - logfile_maxbytes=10MB
86   - logfile_backups=50
  82 + stdout_logfile=/var/log/supervisor/sei_processar_pendencias.log-out
  83 + stderr_logfile=/var/log/supervisor/sei_processar_pendencias.log-err
  84 + stderr_events_enabled=true
87 85  
88 86  
89 87 [program:sei_monitorar_pendencias]
... ... @@ -95,11 +93,9 @@ Estes dois componentes são utilizados para gerenciar a fila de recebimento de n
95 93 autorestart=true
96 94 startsecs=15
97 95 startretries=3
98   - log_stdout=true
99   - log_stderr=true
100   - logfile=/var/log/supervisor/sei_monitorar_pendencias.log
101   - logfile_maxbytes=10MB
102   - logfile_backups=50
  96 + stdout_logfile=/var/log/supervisor/sei_processar_pendencias.log-out
  97 + stderr_logfile=/var/log/supervisor/sei_processar_pendencias.log-err
  98 + stderr_events_enabled=true
103 99  
104 100  
105 101 4. Configurar a tarefa de reinicialização de serviços caso se identifique possíveis indisponibilidades.
... ... @@ -108,9 +104,11 @@ Estes dois componentes são utilizados para gerenciar a fila de recebimento de n
108 104  
109 105 Os procedimento descritos abaixo deverão ser executados no mesmo servidor em que está instalado o **supervisor** e o **gearman** (passo 3).
110 106  
111   - Mova o script **verificar-servicos.sh**, localizado na raiz do diretório do módulo, para a pasta de **sei/bin** do SEI.
  107 + Mova o script **verificar-servicos.sh-systemctl** ou **verificar-servicos.sh-service** de acordo com ambiente, localizado na raiz do diretório do módulo, para a pasta de **sei/bin** do SEI.
112 108  
113   - cp [DIRETORIO_RAIZ_INSTALAÇÃO]/sei/web/modulos/pen/verificar-servicos.sh /opt/sei/bin/
  109 + cp [DIRETORIO_RAIZ_INSTALAÇÃO]/sei/web/modulos/pen/verificar-servicos.sh-sytemctl /opt/sei/bin/verificar-servicos.sh
  110 + ou
  111 + cp [DIRETORIO_RAIZ_INSTALAÇÃO]/sei/web/modulos/pen/verificar-servicos.sh-service /opt/sei/bin/verificar-servicos.sh
114 112  
115 113 Configure este script no serviço de agendamento CRON com uma periodicidade sugerida de 10 minutos, tempo este utilizado para o devido monitoramento e tentativa de reativação dos serviços.
116 114  
... ...
verificar-servicos.sh
... ... @@ -1,37 +0,0 @@
1   -#!/bin/bash
2   -
3   -PATH=/usr/bin:/sbin:/bin:/usr/sbin
4   -export PATH
5   -
6   -if $(service gearmand status | grep -qv "running") ; then
7   - service gearmand start;
8   - LOG="Servico gearman foi iniciado"
9   -fi
10   -
11   -if $(service supervisord status | grep -qv "running") ; then
12   - service supervisord start;
13   - LOG="Servico supervisor foi iniciado"
14   -else
15   -
16   - COMMAND=$(ps -C php -f | grep -o "PendenciasTramiteRN.php");
17   -
18   - if [ -z "$COMMAND" ]
19   - then
20   - service supervisord restart;
21   - LOG="Servico supervisor foi reiniciado"
22   - fi
23   -
24   - COMMAND=$(ps -C php -f | grep -o "ProcessarPendenciasRN.php");
25   -
26   - if [ -z "$COMMAND" ]
27   - then
28   - service supervisord restart;
29   - LOG="Servico supervisor foi reiniciado"
30   - fi
31   -fi
32   -
33   -if [ -n "$LOG" ]
34   -then
35   - #/usr/bin/php console.php log --msg="$LOG" > /dev/null
36   - echo $LOG
37   -fi
verificar-servicos.sh-service 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +#!/bin/bash
  2 +
  3 +PATH=/usr/bin:/sbin:/bin:/usr/sbin
  4 +export PATH
  5 +
  6 +if $(service gearmand status | grep -qv "running") ; then
  7 + service gearmand start;
  8 + LOG="Servico gearman foi iniciado"
  9 +fi
  10 +
  11 +if $(service supervisord status | grep -qv "running") ; then
  12 + service supervisord start;
  13 + LOG="Servico supervisor foi iniciado"
  14 +else
  15 +
  16 + COMMAND=$(ps -C php -f | grep -o "PendenciasTramiteRN.php");
  17 +
  18 + if [ -z "$COMMAND" ]
  19 + then
  20 + service supervisord restart;
  21 + LOG="Servico supervisor foi reiniciado"
  22 + fi
  23 +
  24 + COMMAND=$(ps -C php -f | grep -o "ProcessarPendenciasRN.php");
  25 +
  26 + if [ -z "$COMMAND" ]
  27 + then
  28 + service supervisord restart;
  29 + LOG="Servico supervisor foi reiniciado"
  30 + fi
  31 +fi
  32 +
  33 +if [ -n "$LOG" ]
  34 +then
  35 + #/usr/bin/php console.php log --msg="$LOG" > /dev/null
  36 + echo $LOG
  37 +fi
... ...
verificar-servicos.sh-systemctl 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +#!/bin/bash
  2 +
  3 +PATH=/usr/bin:/sbin:/bin:/usr/sbin
  4 +export PATH
  5 +
  6 +systemctl status gearmand | grep -q "running"
  7 +if [ $? -eq 1 ] ; then
  8 + systemctl start gearmand;
  9 + LOG="Nao foi encontrado gearman. Servico gearman foi iniciado. "
  10 +fi
  11 +
  12 +systemctl status supervisord | egrep -q "running"
  13 +if [ $? -eq 1 ] ; then
  14 + systemctl start supervisord;
  15 + LOG=$LOG"Nao foi encontrado supervisor. Servico supervisor foi iniciado. ";
  16 +else
  17 +
  18 + COMMAND=$(ps -C php -f | grep -o "PendenciasTramiteRN.php");
  19 +
  20 + if [ -z "$COMMAND" ]
  21 + then
  22 + systemctl restart supervisord;
  23 + LOG=$LOG"Nao foi encontrado PendenciasTramiteRN. Servico supervisor foi reiniciado. "
  24 + fi
  25 +
  26 + COMMAND=$(ps -C php -f | grep -o "ProcessarPendenciasRN.php");
  27 +
  28 + if [ -z "$COMMAND" ]
  29 + then
  30 + systemctl restart supervisord;
  31 + LOG=$LOG"Nao foi encontrado ProcessarPendenciasRN. Servico supervisor foi reiniciado. "
  32 + fi
  33 +fi
  34 +
  35 +if [ -n "$LOG" ]
  36 +then
  37 + #/usr/bin/php console.php log --msg="$LOG" > /dev/null
  38 + echo $LOG
  39 +fi
0 40 \ No newline at end of file
... ...