<div dir="ltr">Why  not  to use  Fail2ban  <a href="https://www.voip-info.org/wiki/view/Fail2Ban+%28with+iptables%29+And+Asterisk">https://www.voip-info.org/wiki/view/Fail2Ban+%28with+iptables%29+And+Asterisk</a><br><br><br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><b>Tahir Almas</b><br><br>Managing Partner<br>ICT Innovations<br><a href="http://www.ictinnovations.com" target="_blank">http://www.ictinnovations.com</a><br><a href="http://www.ictbroadcast.com">http://www.ictbroadcast.com</a><br>Leveraging open source in ICT<br><br><br></div></div>
<br><div class="gmail_quote">On Tue, Feb 21, 2017 at 12:28 AM, Tzafrir Cohen <span dir="ltr"><<a href="mailto:tzafrir.cohen@xorcom.com" target="_blank">tzafrir.cohen@xorcom.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Feb 20, 2017 at 11:36:24AM -0300, Victor Villarreal wrote:<br>
> Hi, Oliver.<br>
><br>
> Maybe something like this (add this script to your crontab):<br>
><br>
> ------------------------8<----<wbr>----------------------<br>
><br>
> #!/bin/bash<br>
> #<br>
> # File:         asterisk-watchdog.sh<br>
> # Date:         2015.05.26<br>
> # Build:        v1.0<br>
> # Brief:        Secuencia para monitorizar procesos.<br>
> #<br>
> # ${PATH}: Variable de entorno con las rutas a los ejecutables.<br>
> PATH=/bin:/sbin:/usr/bin:/usr/<wbr>sbin<br>
><br>
> # ${DAEMON}: Demonio a monitorizar.<br>
> DAEMON="asterisk"<br>
><br>
> # ${MSG}: Cuerpo del mensaje a enviar por mail.<br>
> MSG="$(date '+%F %T'): ${DAEMON} se ha caido!"<br>
><br>
> pidof ${DAEMON} > /dev/null 2>&1<br>
><br>
> [ $? -ne 0 ] && { echo ${MSG}; service ${DAEMON} start; }<br>
><br>
> exit 0<br>
<br>
</span>Both Debian 8 and Centos 7 have systemd. Systemd gives you this type of<br>
monitoring almost for free (see previous reply).<br>
<br>
Using cron is generally not a good idea here:<br>
<br>
1. No way to stop Asterisk when you need it.<br>
<br>
2. If Asterisk has failed, it may take up to a minute to restart it.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
               Tzafrir Cohen<br>
icq#16849755              <a href="mailto:jabber%3Atzafrir.cohen@xorcom.com">jabber:tzafrir.cohen@xorcom.<wbr>com</a><br>
<a href="tel:%2B972-50-7952406" value="+972507952406">+972-50-7952406</a>           mailto:<a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.<wbr>com</a><br>
<a href="http://www.xorcom.com" rel="noreferrer" target="_blank">http://www.xorcom.com</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
--<br>
______________________________<wbr>______________________________<wbr>_________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" rel="noreferrer" target="_blank">https://community.asterisk.<wbr>org/</a><br>
<br>
New to Asterisk? Start here:<br>
      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/<wbr>wiki/display/AST/Getting+<wbr>Started</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/<wbr>mailman/listinfo/asterisk-<wbr>users</a><br>
</div></div></blockquote></div><br></div></div>