<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Before using my suggestion below, please consider first that I am a "dummy programmer" and then, that I am using Ubuntu server 12.04 LTS 64 bits. If you are using another distro or version, you may need to adapt the upstart script. Also, I am not sure if this is the right way of doing it, but it worked for me... Finally, I did not convert some of the start-up scripts.<BR> <BR>Now, the problem I see is that this addresses "my problem" (Kamailio+MySQL on Ubuntu running Upstart). However, it would be nice to have a more complete script. I.e.: If you are not running MySQL, then you have to change the upstart script to match your SQL engine. The old init script had a "Should-Start" statement so you could get anything to start before Kamailio (postgresql mysql radius, etc.) without being a "must" like in upstart. But I could not find the equivalent command for this in Upstart docs... So I let here the challenge for the community to improve what I could accomplish so far.<BR> <BR>The first thing you need to do is to remove (or not install) the /etc/init.d/kamailio init script. Then you need to create a symlink to the kamailio upstart conf file that should be at /ect/init/. To do so:<BR> <BR># First save you original init script if you have one<br>mv /etc/init.d/kamailio ~<BR> <BR># Create symlink to upstart .conf file<br>ln -s /etc/init/kamailio.conf /etc/init.d/kamailio<BR> <BR>Then create a /etc/init/kamailio.conf (notice it is /etc/init/ <strong>not</strong> /etc/init.d/) with the following content:<BR> <BR># Kamailio Service<BR> <BR>description "Kamailio server"<br>author "Moacir Ferreira"<BR> <BR># Change anything here<br># to match your environment<br>env NAME=kamailio<br>env DAEMON=/sbin/kamailio<br>env CFGFILE=/etc/kamailio/kamailio.cfg<br>env USER=kamailio<br>env GROUP=kamailio<BR> <BR>start on runlevel [2345]<br>stop on starting rc RUNLEVEL=[016]<BR> <BR># This is required to start Kamailio<br># after MySQL<br>start on started mysql<BR> <BR># This is required when the daemon<br># forks 2 times<br>expect daemon<BR> <BR># Include this to see the nice<br># kamailo init messages at the console<br>console output<BR> <BR>pre-start script<BR> <BR># Do not start kamailio if fork=no is set in the config file<br>if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then<BR> echo "$NAME ERROR: Kamilio not set to fork. Review your config or start it in debug mode.";<BR> exit 1;<br>fi<BR> <BR># Check if kamailio configuration is valid before starting the server.<br>out=$($DAEMON -c 2>&1 > /dev/null)<br>retcode=$?<br>set -e<br>if [ "$retcode" != '0' ]; then<BR> echo "$NAME ERROR: Config file invalid."<br> exit 1;<br>fi<BR> <BR>end script<BR> <BR>exec $DAEMON -f $CFGFILE -u $USER -g $GROUP<BR> <BR># This is the end of the script<BR> <BR>Good luck and Cheers!<BR> <BR>Moacir<br> <BR><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Wed, 14 Nov 2012 06:36:40 -0500<br>From: miconda@gmail.com<br>To: sr-users@lists.sip-router.org<br>CC: moacirferreira@hotmail.com<br>Subject: Re: [SR-Users] Returning problem<br><br>
Hello,<br>
<br>
<div class="ecxmoz-cite-prefix">On 11/13/12 6:15 PM, Moacir Ferreira
wrote:<br>
</div>
<blockquote cite="mid:COL125-W3986EA29065F0966C8AE6C86C0@phx.gbl">
<style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
--></style>
<div dir="ltr">
I wish it were that simple... I have done some "reading" and
found that Ubuntu has changed to upstart <a href="http://upstart.ubuntu.com/cookbook/" target="_blank">http://upstart.ubuntu.com/cookbook/</a>.
However, I could not find how I can start a non "upstart" style
init script like Kamailio has before the upstart styled ones...
I guess that I have to either to get the Kamailio community
to create an upstart script or find some help from the Ubuntu
community how to overcome the problem. Anyway, I think the
Kamailio team should address it as it will become a problem for
everyone using Kamailio on Ubuntu.<br>
<br>
Any help?<br>
</div>
</blockquote>
the link to the upstart documentation you gave has quite big
content, couldn't you find a migration guide from classic init.d to
upstart somewhere out there on the web? Might be easier to do it
then.<br>
<br>
Cheers,<br>
Daniel<br>
<blockquote cite="mid:COL125-W3986EA29065F0966C8AE6C86C0@phx.gbl">
<div dir="ltr"> <br>
Moacir<br>
<br>
From: <a class="ecxmoz-txt-link-abbreviated" href="mailto:4lists@gmail.com">4lists@gmail.com</a><br>
To: <a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
Date: Mon, 12 Nov 2012 14:42:31 -0200<br>
Subject: Re: [SR-Users] Returning problem<br>
<br>
<br>
<div>
<pre>This is more a system initialization problem, so, take a look in your
/etc/rc<run-level>.d directory (or the correspondent one), specially in
the S* files and find out the start sequence. There You'll find the answer.
Edson.
Em 09/11/2012 17:03, Moacir Ferreira escreveu:
> My kamailio start script has the following BEGIN INIT INFO:
>
> #
> ### BEGIN INIT INFO
> # Provides: kamailio
> # Required-Start: $syslog $network $local_fs $time mysql
> # Required-Stop: $syslog $network $local_fs mysql
> # Default-Start: 2 3 4 5
> # Default-Stop: 0 1 6
> # Should-Start: postgresql mysql radius
> # Should-Stop: postgresql mysql radius
> # Short-Description: Start the Kamailio SIP proxy server
> # Description: Start the Kamailio SIP proxy server
> ### END INIT INFO
>
> However, when I boot my server Kamailio will start before mysql. So,
> after boot I can start Kamalio but at boot time it will fail.
>
> Any hints how to fix it? I am running Ubuntu server 12.04 LTS - 64 bits.
> All the code has been compiled at the server.
>
> Cheers!
>
> Moacir
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> <a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
>
</pre>
</div>
</div>
<br>
<fieldset class="ecxmimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="ecxmoz-signature">--
Daniel-Constantin Mierla - <a class="ecxmoz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a class="ecxmoz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a class="ecxmoz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre></div>                                            </div></body>
</html>