<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks Tzafrir for your answer. Because I had some problems
running safe_asterisk script to restart asterisk automatically in our
callcenter , I&#8217;ve developed a simple script that runs from a schedule
task and check if asterisk is running each minute. &nbsp;This is not the best
solution yet but it works properly when asterisk shutdown. However it not let
asterisk generate core dumps files. Is there an error in this script or what I
have to change to get core dumps files from this script. &nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>#!/bin/sh<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>#<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>#Script para levantar el asterisk automaticamente<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>#programado por WL<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>echo &#8220;Checking if asterisk is running&#8221;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>a=`pidof asterisk`<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>if [ &quot;$a&quot; != &quot;&quot; ]; then<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;Everything is OK, Asterisk is UP and
running&quot;;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>else<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;Asterisk Error: NOT RUNNING trying to
restart it in 5 </span></font><span class=q>attempt</span>s</span><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>!!!&quot;;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for ((i=1; i&lt;=5; i+=1)); do<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/sbin/asterisk -g<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>&nbsp;&nbsp; b=`pidof asterisk`<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ &quot;$b&quot; != &quot;&quot; ]; then<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; done<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=ES-AR style='font-size:
10.0pt;font-family:Arial'>fi<o:p></o:p></span></font></p>

<p class=MsoNormal><b><font size=3 color=navy face="Times New Roman"><span
lang=ES-AR style='font-size:12.0pt;color:navy;font-weight:bold'><o:p>&nbsp;</o:p></span></font></b></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>G.A.G.</span></font><span lang=ES-AR><o:p></o:p></span></p>

</div>

</body>

</html>