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

2010-02-12 Thread Tzafrir Cohen
On Thu, Feb 11, 2010 at 07:36:23AM -0500, Leif Madsen wrote:
 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/.  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.
  
  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?).
  
  Please report an issue on http://issues.asterisk.org/
 
 For future reference, the issue reported is #16802.
 
 https://issues.asterisk.org/view.php?id=16802

The report in the bug is not clear.

If you run Asterisk as non-root, asterisk should have write permissions
to the astvarrun directory. Thus it should be the subdirectory
/var/run/asterisk .

Packages on Debian has long ago defaulted to even prevent running as
root, and had astvarrundir set to /var/run/asterisk as a compile-time
default for quite some time.

The Ubuntu packages, based mostly on the Debian ones, had to face the
fact that Ubuntu deletes everything under /var/run by default at boot.
Thus the init.d script was fixed to (re)create that directory.

This fix made it eventually into the Debian packages, and also
(eventually, and independently) into the standard debian asterisk
init.d script.

So the questions to ask are, I believe:

* Should asterisk here be run as root? If so: why?
* Where should the astvarrundir be?

-- 
   Tzafrir Cohen
icq#16849755  jabber:tzafrir.co...@xorcom.com
+972-50-7952406   mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir

-- 
_
-- 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


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

2010-02-12 Thread Brian
On Fri, 2010-02-12 at 14:15 +0200, Tzafrir Cohen wrote:
{snip}
 So the questions to ask are, I believe:
 
 * Should asterisk here be run as root? If so: why?
It suits me to run it that way on the device concerned.
 * Where should the astvarrundir be?
If you leave the defaults as they are (dictated by (!) in asterisk.conf)
then the behaviour you get is Asterisk looking to /var/run/asterisk
which the OS deletes on reboot. The question is why is this the default
behaviour when it breaks systems that clear /var/run

This was - btw - a compile from source, not packaged offering.
 
 -- 
Tzafrir Cohen
 icq#16849755  jabber:tzafrir.co...@xorcom.com
 +972-50-7952406   mailto:tzafrir.co...@xorcom.com
 http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir
 
I disagree. 


-- 
_
-- 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


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

2010-02-12 Thread Tzafrir Cohen
On Fri, Feb 12, 2010 at 12:28:53PM +, Brian wrote:
 On Fri, 2010-02-12 at 14:15 +0200, Tzafrir Cohen wrote:
 {snip}
  So the questions to ask are, I believe:
  
  * Should asterisk here be run as root? If so: why?
 It suits me to run it that way on the device concerned.

Could you please be more specific?

  * Where should the astvarrundir be?
 If you leave the defaults as they are (dictated by (!) in asterisk.conf)
 then the behaviour you get is Asterisk looking to /var/run/asterisk
 which the OS deletes on reboot. The question is why is this the default
 behaviour when it breaks systems that clear /var/run

Because we should make it simple to run Asterisk as non-root.

 
 This was - btw - a compile from source, not packaged offering.

Right. But packagers have a way of running into platform-specific bugs.

-- 
   Tzafrir Cohen
icq#16849755  jabber:tzafrir.co...@xorcom.com
+972-50-7952406   mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir

-- 
_
-- 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


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

2010-02-12 Thread Brian
On Fri, 2010-02-12 at 15:18 +0200, Tzafrir Cohen wrote:
 On Fri, Feb 12, 2010 at 12:28:53PM +, Brian wrote:
  On Fri, 2010-02-12 at 14:15 +0200, Tzafrir Cohen wrote:
  {snip}
   So the questions to ask are, I believe:
   
   * Should asterisk here be run as root? If so: why?
  It suits me to run it that way on the device concerned.
 
 Could you please be more specific?
Is it relevant at all to the problem or bug?
 
   * Where should the astvarrundir be?
  If you leave the defaults as they are (dictated by (!) in asterisk.conf)
  then the behaviour you get is Asterisk looking to /var/run/asterisk
  which the OS deletes on reboot. The question is why is this the default
  behaviour when it breaks systems that clear /var/run
 
 Because we should make it simple to run Asterisk as non-root.
Is this relevant at all to the issue?
 
  
  This was - btw - a compile from source, not packaged offering.
 
 Right. But packagers have a way of running into platform-specific bugs.
The bug is simple and clear. Default build expects /var/run/asterisk to
be persistent. This has no relevance to the user that Asterisk is being
run as. 


Forgive me for being blunt, but if you want to argue politics or fight
about root -v- non privileged that is your prerogative, but please pick
on somebody else - I'm not interested. The simple test is this - would
running it as some other user avoid this problem - answer: no.

Kind regards
Brian.


 
 -- 
Tzafrir Cohen
 icq#16849755  jabber:tzafrir.co...@xorcom.com
 +972-50-7952406   mailto:tzafrir.co...@xorcom.com
 http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir
 


-- 
_
-- 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


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

2010-02-12 Thread Kevin P. Fleming
Brian wrote:

 If you leave the defaults as they are (dictated by (!) in asterisk.conf)
 then the behaviour you get is Asterisk looking to /var/run/asterisk
 which the OS deletes on reboot. The question is why is this the default
 behaviour when it breaks systems that clear /var/run

Because it's impossible to have defaults that work on every possible
system that might do anything the system installer can come up with. It
has only been very recently that any distros at all decided to empty
/var/run on boot, and until now I haven't seen anyone comment about it
or do anything to get Asterisk to be able to accommodate that.

With that said, though, in general Asterisk does not *ever* create any
of the directories it is told to use in /etc/asterisk.conf (or the
defaults in the code, if that file is not present or does not override
them), and this is generally the behavior of most service applications
like Asterisk.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpflem...@digium.com
Check us out at www.digium.com  www.asterisk.org

-- 
_
-- 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


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

2010-02-12 Thread Brian
On Fri, 2010-02-12 at 10:20 -0600, Kevin P. Fleming wrote:
 Brian wrote:
 
  If you leave the defaults as they are (dictated by (!) in asterisk.conf)
  then the behaviour you get is Asterisk looking to /var/run/asterisk
  which the OS deletes on reboot. The question is why is this the default
  behaviour when it breaks systems that clear /var/run
 
 Because it's impossible to have defaults that work on every possible
 system that might do anything the system installer can come up with. 
Quite - but the core as it is expect /var/run to be persistent and on
several flavours of Linux it is not. It's fair to say that /var/run will
probably be available in most cases so could the default behaviour not
be to look there rather than /var/run/asterisk which may not?

I don't want to fight about it and I appreciate your defence of the
current status quo - it's no big deal. I'm more than happy to admit I
did not relaize that /var/run was emptied on Debian based distros on
boot. Perhaps you could pass that information up to whoever builds the
makefile -or add a little into the README as it confuses new users like
me - who just want it to work.

 
 -- 
 Kevin P. Fleming
 Digium, Inc. | Director of Software Technologies
 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
 skype: kpfleming | jabber: kpflem...@digium.com
 Check us out at www.digium.com  www.asterisk.org
 


-- 
_
-- 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


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

2010-02-12 Thread Tzafrir Cohen
On Fri, Feb 12, 2010 at 04:51:29PM +, Brian wrote:
 On Fri, 2010-02-12 at 10:20 -0600, Kevin P. Fleming wrote:
  Brian wrote:
  
   If you leave the defaults as they are (dictated by (!) in asterisk.conf)
   then the behaviour you get is Asterisk looking to /var/run/asterisk
   which the OS deletes on reboot. The question is why is this the default
   behaviour when it breaks systems that clear /var/run
  
  Because it's impossible to have defaults that work on every possible
  system that might do anything the system installer can come up with. 
 Quite - but the core as it is expect /var/run to be persistent and on
 several flavours of Linux it is not. 

Asterisk is not the only service with this problem in Ubuntu.

Check others under /etc/init.d .

 It's fair to say that /var/run will
 probably be available in most cases so could the default behaviour not
 be to look there rather than /var/run/asterisk which may not?

So you say it should be fixed in the init.d script?

As in
http://svnview.digium.com/svn/asterisk?view=revisionrevision=177852

 
 I don't want to fight about it and I appreciate your defence of the
 current status quo - it's no big deal. I'm more than happy to admit I
 did not relaize that /var/run was emptied on Debian based distros on
 boot. Perhaps you could pass that information up to whoever builds the
 makefile -or add a little into the README as it confuses new users like
 me - who just want it to work.

Adding documentation is what you do when things fail to work. I suspect
you use an older init.d script.

Alternatively, you can use the simpler upstart conf file:
http://svnview.digium.com/svn/asterisk/trunk/contrib/upstart/asterisk.user.conf?view=markup

-- 
   Tzafrir Cohen
icq#16849755  jabber:tzafrir.co...@xorcom.com
+972-50-7952406   mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir

-- 
_
-- 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


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

2010-02-12 Thread Brian
On Fri, 2010-02-12 at 19:20 +0200, Tzafrir Cohen wrote:

 Adding documentation is what you do when things fail to work. I suspect
 you use an older init.d script.
 
You are just being silly now. Good documentation is essential to
everything.

With regards to your comments about the init.d script, it was provided
with 1.6.1 as an extra and worked out of the box. The change is with
1.6.2 where it no longer works out of the box. To me that is not
intended operation - or a change which should be documented.

I don't agree with you as what you are saying has no legs - the fix is
simple insofar as removing '(!)' from asterisk.conf, but it's a bit
sloppy to expect a directory to stay persistent where it may well not be
the case. Even by your own metric this would make 'things fail to work'
and by your own suggestion the fix for that is to document the issue?

Have a pleasant weekend.


-- 
_
-- 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


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

2010-02-12 Thread Tzafrir Cohen
On Fri, Feb 12, 2010 at 06:24:02PM +, Brian wrote:
 On Fri, 2010-02-12 at 19:20 +0200, Tzafrir Cohen wrote:
 
  Adding documentation is what you do when things fail to work. I suspect
  you use an older init.d script.
  
 You are just being silly now. Good documentation is essential to
 everything.

I prefer fixing a bug than documenting a workaround.

 
 With regards to your comments about the init.d script, it was provided
 with 1.6.1 as an extra and worked out of the box. The change is with
 1.6.2 where it no longer works out of the box. To me that is not
 intended operation - or a change which should be documented.
 
 I don't agree with you as what you are saying has no legs - the fix is
 simple insofar as removing '(!)' from asterisk.conf, but it's a bit
 sloppy to expect a directory to stay persistent where it may well not be
 the case. Even by your own metric this would make 'things fail to work'
 and by your own suggestion the fix for that is to document the issue?

The pathes in the generated asterisk.conf are the built-in ones. If
removing the '(!)' solved anything, something went wrong. My guess is
that your asterisk.conf is older than your asterisk binaries.

-- 
   Tzafrir Cohen
icq#16849755  jabber:tzafrir.co...@xorcom.com
+972-50-7952406   mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir

-- 
_
-- 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


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

2010-02-11 Thread Leif Madsen
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/.  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.
 
 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?).
 
 Please report an issue on http://issues.asterisk.org/

For future reference, the issue reported is #16802.

https://issues.asterisk.org/view.php?id=16802

Leif

-- 
_
-- 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


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

2010-02-10 Thread Ken Leland III
Brian,

It could be that the ownership/permissions on the directory are not correct.
Are you running asterisk as asterisk:asterisk or root:root?

Here is an article that lists the directories and what the 
ownership/permissions on each one should be:

http://www.voip-info.org/wiki/view/Asterisk+non-root

On Wed, Feb 10, 2010 at 11:57:44AM +, Brian wrote:
 Since upgrading from 1.6.1 to 1.6.2 I get this error on boot:
 Unable to open pid file '/var/run/asterisk/asterisk.pid': No such file
 or directory
 
 Or if I try to connect to Asterisk:
 Unable to connect to remote asterisk
 (does /var/run/asterisk/asterisk.ctl exist?)
 
 If I manually create /var/run/asterisk/ and restart Asterisk I can
 connect to it, but if the server is rebooted /var/run/asterisk/
 disappears and warning comes back.
 
 I could doctor the init.d script to overcome this, but I'm not sure it's
 the right thing to do. Can anyone explain the best way for me to get
 over this?
 
 
 -- 
 _
 -- 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

-- 
_
-- 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


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

2010-02-10 Thread Brian
On Wed, 2010-02-10 at 08:54 -0500, Ken Leland III wrote:
 Brian,
 
 It could be that the ownership/permissions on the directory are not correct.
 Are you running asterisk as asterisk:asterisk or root:root?
 
 Here is an article that lists the directories and what the 
 ownership/permissions on each one should be:
 
 http://www.voip-info.org/wiki/view/Asterisk+non-root

Thanks for that, but no - it runs as root, and root can
create/access /var/run without any issues. I'm boggled...


-- 
_
-- 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


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

2010-02-10 Thread Danny Nicholas
It seems to me that the restart is creating asterisk.pid in the wrong
place.  Try this - 
- find /|grep asterisk.pid 
This will tell you where the mislocated pid is being created and you can
adjust the script accordingly.
 
--
Danny Nicholas 
--
 

-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Brian
Sent: Wednesday, February 10, 2010 8:15 AM
To: Ken Leland III
Cc: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] Unable to open pid file
'/var/run/asterisk/asterisk.pid': No such file or directory

On Wed, 2010-02-10 at 08:54 -0500, Ken Leland III wrote:
 Brian,
 
 It could be that the ownership/permissions on the directory are not
correct.
 Are you running asterisk as asterisk:asterisk or root:root?
 
 Here is an article that lists the directories and what the
ownership/permissions on each one should be:
 
 http://www.voip-info.org/wiki/view/Asterisk+non-root

Thanks for that, but no - it runs as root, and root can
create/access /var/run without any issues. I'm boggled...


-- 
_
-- 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


-- 
_
-- 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


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

2010-02-10 Thread Brian
On Wed, 2010-02-10 at 14:14 +, Brian wrote:
 On Wed, 2010-02-10 at 08:54 -0500, Ken Leland III wrote:
  Brian,
  
  It could be that the ownership/permissions on the directory are not correct.
  Are you running asterisk as asterisk:asterisk or root:root?
  
  Here is an article that lists the directories and what the 
  ownership/permissions on each one should be:
  
  http://www.voip-info.org/wiki/view/Asterisk+non-root
 
 Thanks for that, but no - it runs as root, and root can
 create/access /var/run without any issues. I'm boggled...
Answering my own question the solution lies
in /etc/asterisk/asterisk.conf:

Take the (!) out of /etc/asterisk/asterisk.conf

Whilst logic would tell me to replace:
astrundir = /var/run
to
astrundir = /var/run/asterisk

...this did not work. 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?

Leaving: astrundir = /var/run as it is and removing (!)
from /etc/asterisk/asterisk.conf does the trick. On rebooting /var/run
gets the required .ctl/.pid files and all warnings are banished:

srwxr-xr-x  1 root   root  0 2010-02-10 14:50 asterisk.ctl
-rw-r--r--  1 root   root  5 2010-02-10 14:50 asterisk.pid
into /var/run and all warnings vanish of missing .pid and .ctl files are
banished.

Hopefully this will help someone else. I've seen lots of solutions
saying 'create /var/run/asterisk' that have not stood the test of a
reboot.



-- 
_
-- 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


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

2010-02-10 Thread Jason Parker
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/.  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.

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?).

Please report an issue on http://issues.asterisk.org/

-- 
_
-- 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


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

2010-02-10 Thread Brian
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


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

2010-02-10 Thread Duncan Turnbull
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


-- 
_
-- 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


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

2010-02-10 Thread Tzafrir Cohen
On Thu, Feb 11, 2010 at 08:45:05AM +1300, Duncan Turnbull wrote:
 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

Please use ':' as a separator for chown.

chown $user: file   # (empty group) chowns the file to the default group
of the uiser, which means that it's safe to leave AST_GROUP set to an
empty value.

-- 
   Tzafrir Cohen
icq#16849755  jabber:tzafrir.co...@xorcom.com
+972-50-7952406   mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir

-- 
_
-- 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