[asterisk-users] ztdummy does not load properly at server startup

Tzafrir Cohen tzafrir.cohen at xorcom.com
Fri Apr 20 18:15:52 MST 2007


Replying to Theo Band's post. Please don't use HTML mail...

Matthew J. Roth wrote:
> Theo,
>
> Unless things have changed significantly in the newer releases, you
> must load zaptel prior to loading ztdummy.  Additionally, the zaptel
> devices are not created instantly, so after you load zaptel you must
> wait a few seconds before loading ztdummy.  You can perform some sort
> of polling if you want to script this, but a less sophisticated method
> is just to sleep for 10 or 15 seconds between the calls to modprobe.
>
> If your goal is to start Asterisk automatically at boot, some init
> scripts for different distributions are available at
> <http://svn.digium.com/view/asterisk/branches/1.4/contrib/init.d/>. 
> I'm using Fedora, so I installed 'rc.redhat.asterisk' with chkconfig
> as follows:
>
> # install -m 755 ./rc.redhat.asterisk /etc/rc.d/init.d/asterisk
> # chkconfig --add asterisk
> # chkconfig --list asterisk
> asterisk        0:off   1:off   2:on    3:on    4:on    5:on    6:off
The make install already did that for me .
>
>
> Note that I made the following customizations to the script prior to
> installing it:
>
> * I don't want to run safe_asterisk, so I comment out all of the lines
> that reference the SAFE_ASTERISK variable.

Not using safe_asterisk is a good idea.

> * I want to load ztdummy and raise the open file limit, so I add the
> following lines to the start() function immediately prior to the
> 'daemon' statement:
>     modprobe zaptel > /dev/null 2> /dev/null
>     sleep 15
>     modprobe ztdummy > /dev/null 2> /dev/null
>     ztcfg > /dev/null 2> /dev/null

As you don't need ztcfg for ztdummy, the only line you need from the
above four lines is:

  modprobe ztdummy

Or use the zaptel init script. If it finds no zaptel timing source it
modprobes ztdummy.

> >     ulimit -n 65536 > /dev/null 2> /dev/null
> > * And add the following lines to the stop() function, immediately
> > after the 'RETVAL=$?' line:
> >     rmmod ztdummy > /dev/null 2> /dev/null
> >     rmmod zaptel > /dev/null 2> /dev/null

With the latest zaptel init script, you can simply use it (once the
modules unloading fixes are in place). But then aghain, there is no harm
whatsoever from not unloading ztdummy at system shutdown.

> Yes it works indeed thanks. It turns out that (for me) the "modprobe
> ztdummy" alone works as well. I do get an error message as shown before,

That's because of the bogus setting in /etc/modprobe.conf that runs
ztcfg needlessly on the time of the load of ztdummy, and because uev is
slightly slow in creating the zaptel devices (the init.d script only
runs ztcfg after wait_fot_zapctl).

> but both ztummy and zaptel get loaded and Meetme() works. The 15 seconds
> delay would add to the boot time....

You can avoid all of that sleep (or at least most of it) easily.

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-users mailing list