Commit 727624a58ff970d26c0d83af4dc74eb93fe603d7
1 parent
6f1de85b
Exists in
master
and in
19 other branches
[Fixed #18] Falha no agendamento do script Verificar Serviços
Showing
1 changed file
with
18 additions
and
19 deletions
Show diff stats
verificar-servicos.sh
| ... | ... | @@ -3,35 +3,34 @@ |
| 3 | 3 | PATH=/usr/bin:/sbin:/bin:/usr/sbin |
| 4 | 4 | export PATH |
| 5 | 5 | |
| 6 | -if $(service gearmand status | grep -qv "running") ; then | |
| 7 | - service gearmand start; | |
| 8 | - LOG="Servico gearman foi iniciado" | |
| 6 | +GEARMAN=$(ls /etc/init.d | grep -owih gearman.* | grep -v job) | |
| 7 | +ps cax | grep -ih gearman.* | grep -v job > /dev/null | |
| 8 | +if [ $? -ne 0 ]; then | |
| 9 | + /etc/init.d/$GEARMAN start; | |
| 10 | + echo "Serviço gearman foi iniciado" | |
| 9 | 11 | fi |
| 10 | 12 | |
| 11 | -if $(service supervisord status | grep -qv "running") ; then | |
| 12 | - service supervisord start; | |
| 13 | - LOG="Servico supervisor foi iniciado" | |
| 14 | -else | |
| 15 | 13 | |
| 16 | - COMMAND=$(ps -C php -f | grep -o "PendenciasTramiteRN.php"); | |
| 14 | +SUPERVISOR=$(ls /etc/init.d | grep -owih supervisor.*) | |
| 15 | +ps cax | grep -ih supervisor.* > /dev/null | |
| 16 | +if [ $? -ne 0 ]; then | |
| 17 | + /etc/init.d/$SUPERVISOR start; | |
| 18 | + echo "Serviço supervisor foi iniciado" | |
| 19 | +else | |
| 17 | 20 | |
| 21 | + COMMAND=$(ps -C php -f | grep -o "PendenciasTramiteRN.php"); | |
| 18 | 22 | if [ -z "$COMMAND" ] |
| 19 | 23 | then |
| 20 | - service supervisord restart; | |
| 21 | - LOG="Servico supervisor foi reiniciado" | |
| 24 | + /etc/init.d/$SUPERVISOR stop; | |
| 25 | + /etc/init.d/$SUPERVISOR start; | |
| 26 | + echo "Serviço supervisor foi reiniciado" | |
| 22 | 27 | fi |
| 23 | 28 | |
| 24 | 29 | COMMAND=$(ps -C php -f | grep -o "ProcessarPendenciasRN.php"); |
| 25 | - | |
| 26 | 30 | if [ -z "$COMMAND" ] |
| 27 | 31 | then |
| 28 | - service supervisord restart; | |
| 29 | - LOG="Servico supervisor foi reiniciado" | |
| 32 | + /etc/init.d/$SUPERVISOR stop; | |
| 33 | + /etc/init.d/$SUPERVISOR start; | |
| 34 | + echo "Serviço supervisor foi reiniciado" | |
| 30 | 35 | fi |
| 31 | 36 | fi |
| 32 | - | |
| 33 | -if [ -n "$LOG" ] | |
| 34 | -then | |
| 35 | - #/usr/bin/php console.php log --msg="$LOG" > /dev/null | |
| 36 | - echo $LOG | |
| 37 | -fi | ... | ... |