On Mon, Feb 20, 2017 at 11:36:24AM -0300, Victor Villarreal wrote:
> Hi, Oliver.
> 
> Maybe something like this (add this script to your crontab):
> 
> ------------------------8<--------------------------
> 
> #!/bin/bash
> #
> # File:         asterisk-watchdog.sh
> # Date:         2015.05.26
> # Build:        v1.0
> # Brief:        Secuencia para monitorizar procesos.
> #
> # ${PATH}: Variable de entorno con las rutas a los ejecutables.
> PATH=/bin:/sbin:/usr/bin:/usr/sbin
> 
> # ${DAEMON}: Demonio a monitorizar.
> DAEMON="asterisk"
> 
> # ${MSG}: Cuerpo del mensaje a enviar por mail.
> MSG="$(date '+%F %T'): ${DAEMON} se ha caido!"
> 
> pidof ${DAEMON} > /dev/null 2>&1
> 
> [ $? -ne 0 ] && { echo ${MSG}; service ${DAEMON} start; }
> 
> exit 0

Both Debian 8 and Centos 7 have systemd. Systemd gives you this type of
monitoring almost for free (see previous reply).

Using cron is generally not a good idea here:

1. No way to stop Asterisk when you need it.

2. If Asterisk has failed, it may take up to a minute to restart it.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.co...@xorcom.com
+972-50-7952406           mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to