918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change
on this file since 83f20d1 was
b351d8a,
checked in by Ramón M. Gómez <ramongomez@…>, 6 years ago
|
#875: Removing old ogAdmRepo service.
|
-
Property mode set to
100755
|
File size:
1.2 KB
|
Rev | Line | |
---|
[89a8208] | 1 | #!/bin/bash |
---|
[d7fe54a] | 2 | # opengnsys.cron - Script para comprobar si los servicios de OpenGnsys están levantados |
---|
[0b3fc2d] | 3 | # e iniciarlos automáticamente. |
---|
| 4 | # Nota: este script debe ser lanzado por Cron cada minuto. |
---|
| 5 | |
---|
| 6 | |
---|
[24f5516] | 7 | # Variables. |
---|
| 8 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} |
---|
| 9 | LOGDIR="$OPENGNSYS/log" |
---|
[57cf15b] | 10 | DEFAULTFILE=/etc/default/opengnsys |
---|
[0b3fc2d] | 11 | typeset -i OGCPU # % uso CPU |
---|
[24f5516] | 12 | |
---|
[57cf15b] | 13 | # Comprobar servicios que deben estar activos. |
---|
| 14 | [ -f $DEFAULTFILE ] && source $DEFAULTFILE |
---|
[24f5516] | 15 | |
---|
[cafc669] | 16 | # Salir si no se debe ejecutar la revisión en el cron. |
---|
| 17 | [ "$RUN_CRONJOB" == "no" ] && exit |
---|
| 18 | |
---|
[d7fe54a] | 19 | # Comprobar si está activo el servidor OpenGnsys. |
---|
[0b3fc2d] | 20 | if [ "$RUN_OGADMSERVER" == "yes" ]; then |
---|
| 21 | # Parar procesos ogAdmServer si consume más de 90% de CPU. |
---|
| 22 | OGPID=$(pgrep ogAdmServer) |
---|
[a36fbae] | 23 | OGCPU=$(top -b -n 1 -p $OGPID 2>/dev/null | awk -v p=$OGPID '$1~p {printf "%d",$9}') |
---|
[0b3fc2d] | 24 | if [ $OGCPU -gt 90 ]; then |
---|
[a36fbae] | 25 | date +"%d/%m/%Y %H:%M AVISO: ogAdmServer (PID=$OGPID) parado, consumiendo $OGCPU % de CPU" >> $LOGDIR/ogAdmServer.log |
---|
[0b3fc2d] | 26 | kill -9 $OGPID |
---|
| 27 | fi |
---|
| 28 | # Reiniciar servicios si proceso ogAdmServer está caído. |
---|
| 29 | if ! pgrep ogAdmServer >/dev/null; then |
---|
[a36fbae] | 30 | date +"%d/%m/%Y %H:%M ERROR: El servicio ogAdmServer estaba caido, se reinicia" >> $LOGDIR/ogAdmServer.log |
---|
[0b3fc2d] | 31 | /etc/init.d/opengnsys restart |
---|
| 32 | fi |
---|
[24f5516] | 33 | fi |
---|
| 34 | |
---|
Note: See
TracBrowser
for help on using the repository browser.