[asterisk-users] Unable to open pid file '/var/run/asterisk/asterisk.pid': No such file or directory

Duncan Turnbull duncan at e-simple.co.nz
Wed Feb 10 13:45:05 CST 2010


The other way on Debian/Ubuntu is just to test the existence of the dir and create it if needed

If you add this to the /etc/init.d/asterisk near the start you should be fine

if ! [ -d /var/run/asterisk ] ; then
        mkdir /var/run/asterisk
        chown $AST_USER.$AST_GROUP /var/run/asterisk
        exit 0
fi

Set the ownership as required 

Cheers Duncan

On 11/02/2010, at 7:50 AM, Brian wrote:

> On Wed, 2010-02-10 at 11:24 -0600, Jason Parker wrote:
>> Brian wrote:
>>> Each time the server is rebooted Asterisk duly
>>> deletes the manually created /var/run/asterisk directory - quite why it
>>> does this I just don't know - perhaps it is a bug?
>>> 
>> 
>> Your assumption is incorrect.  Some Linux distributions will empty /var/run/ on 
>> boot, just as they do with /tmp/.  
> Thanks Jason - that had never dawned on me, but I've just tested it and
> indeed it does.
> 
>> I do believe you're right, however, in 
>> suggesting that there is a bug in Asterisk.  It appears that Asterisk creates 
>> /var/run/asterisk/ during install and assumes that it will always exist.
> Agreed - that would make sense that by default it thinks the directory
> is there. The workaround / fix is to take out the (!)
> from /etc/asterisk/asterisk.conf and allowing the default setting of:
> astrundir => /var/run to come into play. It then puts the .pid and .ctl
> in the root of /var/run
>> 
>> Some of the sample init scripts (Debian) create that directory before starting 
>> Asterisk.  This should be done in all of them (or in Asterisk itself, maybe?).
> The one I had didn't - but I could have added it. I just wanted to be
> sure I was doing the right thing.
>> 
>> Please report an issue on http://issues.asterisk.org/
> Done - but I'm a bit embarrassed as it seems so trivial.
> 
> Thank you for your help.
>> 
> 
> 
> -- 
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list