[Freeswitch-users] Freeswitch is showing Incorrect time

Philippe Le Toquin philippe at ppmt.org
Sat Mar 16 04:42:05 MSK 2013


Hello all,

As a follow up to my question here is the solution that I implemented 
and that seems to work

I rebooted the box several times before that fix and the time was always 
wrong
After the fix so far the time has always been correct :)

The "secret" is insserv which is used to give some dependencies on the 
startup of the services started by init.d

http://serverfault.com/questions/340408/debian-squeeze-startup-order-of-services

so in /etc/insserv/overrides I created a file called freeswitch (I 
understand it must the same as the name in /etc/init.d/

and in it I copied the following

### BEGIN INIT INFO
# Provides:          freeswitch
# Required-Start:    $network $local_fs $remote_fs ntp
# Required-Stop:     $network $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: The FreeSwitch Voice Switching System
# Description:       An advanced platform for voice services
### END INIT INFO


You can normally find that templated at the beginning of each file in 
/etc/init.d

On the list starting with # Required-Start I added at the end the 
service that must be started before (here ntp)

Then all you need to do is :

insserv -d

and after the service will be reordered accordingly in /etc/rc.*

Thanks all for your help. I have learn new things in the process and I 
am happy about it.

/Philippe

On 13-03-12 09:02 AM, Steven Ayre wrote:
>
>     Yes there was a reboot (power cut). But it is not the first time I
>     reboot that box and the time was always good before.
>
>
> Which is why I mentioned when FS starts before/after NTP sets the 
> date. If you haven't specified in your init.d/equivalent that FS 
> depends on the time having been set then you may have a race condition 
> on whether FS or NTP starts first.
>
> Perhaps in previous reboots NTP won the race, but FS did this time. Or 
> NTP failed on first startup, eg if there was an Internet outage at boot.
>
> -Steve
>
>
>
> On 12 March 2013 12:41, Philippe Le Toquin <philippe at ppmt.org 
> <mailto:philippe at ppmt.org>> wrote:
>
>     Yes there was a reboot (power cut). But it is not the first time I
>     reboot that box and the time was always good before.
>
>     May be an update to Debian changed the behaviour of the time
>     setting. As time is not critical for me I am not too worried about it.
>
>     The important thing is that with the help from all of you, I ended
>     looking a bit more into the CLI and managed to learn a bit. May be
>     it is me but the cli is not the easiest
>     I ever played with :)
>
>
>
>
>     On 12 March 2013 04:49, Steven Ayre <steveayre at gmail.com
>     <mailto:steveayre at gmail.com>> wrote:
>
>         Did it reboot?
>
>         Many embedded devices use NTP to get the correct date when
>         they first boot. Until NTP sets the correct time they would
>         show the wrong (default) time, and if FS starts before that
>         gets set it could be using the incorrect time.
>
>         -Steve
>
>
>
>         On 11 March 2013 23:37, Philippe Le Toquin <philippe at ppmt.org
>         <mailto:philippe at ppmt.org>> wrote:
>
>             what is strange is that until 2 days ago it was fine and
>             reporting the right time !
>
>             anyway the fsctl sync_clock has done the trick!
>
>             I will keep an eye on it and create a script to init it if
>             needed
>
>             Thanks all !
>
>
>             fsctl sync_clock
>             +OK clock synchronized
>
>             2000-01-01 18:31:55.160499 [INFO] switch_time.c:476 Clock
>             synchronized to system time.
>             2013-03-11 19:34:54.903637 [WARNING]
>             switch_scheduler.c:114 Task was executed late by 416275370
>             seconds 1 heartbeat (core)
>             2013-03-11 19:34:54.903637 [WARNING]
>             switch_scheduler.c:114 Task was executed late by 416275330
>             seconds 2 check_ip (core)
>             2013-03-11 19:34:54.903637 [WARNING]
>             switch_scheduler.c:114 Task was executed late by 416274543
>             seconds 3 limit_hash_cleanup (mod_hash)
>             2013-03-11 19:34:56.503615 [NOTICE] sofia_reg.c:417
>             Registering VoipMS
>             2013-03-11 19:34:56.503615 [NOTICE] sofia_reg.c:417
>             Registering FPL
>
>
>             /Philippe
>
>
>             On 13-03-11 06:08 PM, Dmitry Lysenko wrote:
>>             It seems Jeff is right. According to
>>             http://www.plugcomputer.org/plugforum/index.php?topic=1771.msg10761#msg10761
>>             Guruplug standart version does not have RTC battery.
>>
>>             Best regards,
>>              Dmitry.
>>
>>
>>             2013/3/11 Jeff Leung <jleung at v10networks.ca
>>             <mailto:jleung at v10networks.ca>>
>>
>>                 Embedded devices at that scale probably don't even
>>                 feature a battery or a way to preserve the RTC's
>>                 time. In that case you'll have to write a bunch more
>>                 of init scripts to force ntp to sync to the real time
>>                 first before starting any daemons up
>>
>>                 *From:*freeswitch-users-bounces at lists.freeswitch.org
>>                 <mailto:freeswitch-users-bounces at lists.freeswitch.org> [mailto:freeswitch-users-bounces at lists.freeswitch.org
>>                 <mailto:freeswitch-users-bounces at lists.freeswitch.org>]
>>                 *On Behalf Of *Philippe Le Toquin
>>                 *Sent:* Monday, March 11, 2013 11:44 AM
>>                 *To:* FreeSWITCH Users Help
>>                 *Subject:* Re: [Freeswitch-users] Freeswitch is
>>                 showing Incorrect time
>>
>>                 Thanks all,
>>
>>                 I will check the internal tonight. I actually use a
>>                 Guruplug running Debian. May that power cut did
>>                 something more than rebooting the box :(
>>
>>                 I will run  the command to sync the clock. I am not
>>                 too worried about the CDRs since I am the only user
>>                 on this box. It is a home PBX
>>
>>                 I really need to learn a bit more the CLI. I tried to
>>                 look but could not work a command for it.
>>
>>                 15 years of billing....I can see why a customer would
>>                 be upset :D
>>
>>                 I will also check when Freeswitch is started. I
>>                 thought it was the last one to start but may be not.
>>
>>                 /Philippe
>>
>>                 On 10 March 2013 20:37, Andrew Latham
>>                 <lathama at gmail.com <mailto:lathama at gmail.com>> wrote:
>>
>>                 On Sun, Mar 10, 2013 at 8:25 PM, Philippe Le Toquin
>>                 <philippe at ppmt.org <mailto:philippe at ppmt.org>> wrote:
>>                 > Hello,
>>                 >
>>                 > Not sure why but recently I noticed that Freeswitch
>>                 is logging data with the
>>                 > wrong date
>>                 >
>>                 > I noticed it first in the freeswitch log but I can
>>                 see it also in the log
>>                 > that are display in the cli itself
>>                 >
>>                 > the computer itself is ok
>>                 >
>>                 > ~# date
>>                 > Sun Mar 10 20:13:05 EDT 2013
>>                 >
>>                 > but :
>>                 >
>>                 > freeswitch at internal> version
>>                 > FreeSWITCH Version
>>                 1.3.13b+git~20130108T204816Z~8e892abdef (git 8e892ab
>>                 > 2013-01-08 20:48:16Z)
>>                 >
>>                 > freeswitch at internal> strftime
>>                 > 1999-12-31 19:07:40
>>                 >
>>                 > from freeswtich.log
>>                 > 1999-12-31 19:14:09.460477 [WARNING]
>>                 sofia_reg.c:1506 SIP auth challenge
>>                 > (REGISTER) on sofia profile 'internal' for
>>                 [1000 at xx.xx.xx.xx <mailto:1000 at xx.xx.xx.xx>] from ip
>>                 > xx.xx.xx.xx
>>                 >
>>                 >
>>                 > This is right after a reboot since I thought a
>>                 reboot would may be fix it
>>                 >
>>                 > where does FS takes its time from?
>>                 >
>>                 > The last time it was correctly logged was on the
>>                 9th of March ! We had a
>>                 > power cut that caused the system to reboot
>>                 >
>>                 > thanks
>>                 >
>>                 > /Philippe
>>
>>                 Check your hardware clock...
>>
>>                 man hwclock
>>
>>                 --
>>                 ~ Andrew "lathama" Latham lathama at gmail.com
>>                 <mailto:lathama at gmail.com> http://lathama.net ~
>>
>>
>>                 _________________________________________________________________________
>>                 Professional FreeSWITCH Consulting Services:
>>                 consulting at freeswitch.org
>>                 <mailto:consulting at freeswitch.org>
>>                 http://www.freeswitchsolutions.com
>>
>>                 FreeSWITCH-powered IP PBX: The CudaTel Communication
>>                 Server
>>                 
>>
>>                 Official FreeSWITCH Sites
>>                 http://www.freeswitch.org
>>                 http://wiki.freeswitch.org
>>                 http://www.cluecon.com
>>
>>                 FreeSWITCH-users mailing list
>>                 FreeSWITCH-users at lists.freeswitch.org
>>                 <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>                 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>                 UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>                 http://www.freeswitch.org
>>
>>
>>                 _________________________________________________________________________
>>                 Professional FreeSWITCH Consulting Services:
>>                 consulting at freeswitch.org
>>                 <mailto:consulting at freeswitch.org>
>>                 http://www.freeswitchsolutions.com
>>
>>                 FreeSWITCH-powered IP PBX: The CudaTel Communication
>>                 Server
>>                 
>>
>>                 Official FreeSWITCH Sites
>>                 http://www.freeswitch.org
>>                 http://wiki.freeswitch.org
>>                 http://www.cluecon.com
>>
>>                 FreeSWITCH-users mailing list
>>                 FreeSWITCH-users at lists.freeswitch.org
>>                 <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>                 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>                 UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>                 http://www.freeswitch.org
>>
>>
>>
>>
>>             _________________________________________________________________________
>>             Professional FreeSWITCH Consulting Services:
>>             consulting at freeswitch.org  <mailto:consulting at freeswitch.org>
>>             http://www.freeswitchsolutions.com
>>
>>             
>>             
>>
>>             Official FreeSWITCH Sites
>>             http://www.freeswitch.org
>>             http://wiki.freeswitch.org
>>             http://www.cluecon.com
>>
>>             FreeSWITCH-users mailing list
>>             FreeSWITCH-users at lists.freeswitch.org  <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>             http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>             UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>             http://www.freeswitch.org
>
>
>             _________________________________________________________________________
>             Professional FreeSWITCH Consulting Services:
>             consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>             http://www.freeswitchsolutions.com
>
>             
>             
>
>             Official FreeSWITCH Sites
>             http://www.freeswitch.org
>             http://wiki.freeswitch.org
>             http://www.cluecon.com
>
>             FreeSWITCH-users mailing list
>             FreeSWITCH-users at lists.freeswitch.org
>             <mailto:FreeSWITCH-users at lists.freeswitch.org>
>             http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>             UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>             http://www.freeswitch.org
>
>
>
>         _________________________________________________________________________
>         Professional FreeSWITCH Consulting Services:
>         consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>         http://www.freeswitchsolutions.com
>
>         
>         
>
>         Official FreeSWITCH Sites
>         http://www.freeswitch.org
>         http://wiki.freeswitch.org
>         http://www.cluecon.com
>
>         FreeSWITCH-users mailing list
>         FreeSWITCH-users at lists.freeswitch.org
>         <mailto:FreeSWITCH-users at lists.freeswitch.org>
>         http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>         UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>         http://www.freeswitch.org
>
>
>
>     _________________________________________________________________________
>     Professional FreeSWITCH Consulting Services:
>     consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>     http://www.freeswitchsolutions.com
>
>     
>     
>
>     Official FreeSWITCH Sites
>     http://www.freeswitch.org
>     http://wiki.freeswitch.org
>     http://www.cluecon.com
>
>     FreeSWITCH-users mailing list
>     FreeSWITCH-users at lists.freeswitch.org
>     <mailto:FreeSWITCH-users at lists.freeswitch.org>
>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>     http://www.freeswitch.org
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130315/4e0c0e16/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list