close
Warning:
Failed to sync with repository "ogBrowser-Git": (1366, "Incorrect string value: '\\xF0\\x9F\\x93\\xA6 I...' for column 'message' at row 1"); repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
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-instalacionwebconsole3
|
Last change
on this file since b966d519 was
b351d8a,
checked in by Ramón M. Gómez <ramongomez@…>, 7 years ago
|
|
#875: Removing old ogAdmRepo service.
|
-
Property mode set to
100755
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | #!/bin/bash |
|---|
| 2 | # opengnsys.cron - Script para comprobar si los servicios de OpenGnsys están levantados |
|---|
| 3 | # e iniciarlos automáticamente. |
|---|
| 4 | # Nota: este script debe ser lanzado por Cron cada minuto. |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | # Variables. |
|---|
| 8 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} |
|---|
| 9 | LOGDIR="$OPENGNSYS/log" |
|---|
| 10 | DEFAULTFILE=/etc/default/opengnsys |
|---|
| 11 | typeset -i OGCPU # % uso CPU |
|---|
| 12 | |
|---|
| 13 | # Comprobar servicios que deben estar activos. |
|---|
| 14 | [ -f $DEFAULTFILE ] && source $DEFAULTFILE |
|---|
| 15 | |
|---|
| 16 | # Salir si no se debe ejecutar la revisión en el cron. |
|---|
| 17 | [ "$RUN_CRONJOB" == "no" ] && exit |
|---|
| 18 | |
|---|
| 19 | # Comprobar si está activo el servidor OpenGnsys. |
|---|
| 20 | if [ "$RUN_OGADMSERVER" == "yes" ]; then |
|---|
| 21 | # Parar procesos ogAdmServer si consume más de 90% de CPU. |
|---|
| 22 | OGPID=$(pgrep ogAdmServer) |
|---|
| 23 | OGCPU=$(top -b -n 1 -p $OGPID 2>/dev/null | awk -v p=$OGPID '$1~p {printf "%d",$9}') |
|---|
| 24 | if [ $OGCPU -gt 90 ]; then |
|---|
| 25 | date +"%d/%m/%Y %H:%M AVISO: ogAdmServer (PID=$OGPID) parado, consumiendo $OGCPU % de CPU" >> $LOGDIR/ogAdmServer.log |
|---|
| 26 | kill -9 $OGPID |
|---|
| 27 | fi |
|---|
| 28 | # Reiniciar servicios si proceso ogAdmServer está caído. |
|---|
| 29 | if ! pgrep ogAdmServer >/dev/null; then |
|---|
| 30 | date +"%d/%m/%Y %H:%M ERROR: El servicio ogAdmServer estaba caido, se reinicia" >> $LOGDIR/ogAdmServer.log |
|---|
| 31 | /etc/init.d/opengnsys restart |
|---|
| 32 | fi |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.