[Home]

Summary:ASTERISK-04722: Redhat init script does not detect an already running instance
Reporter:c960657 (c960657)Labels:
Date Opened:2005-07-28 15:02:39Date Closed:2011-06-07 14:10:46
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:If I by mistake call "/etc/init.d/asterisk start" twice, I get two instances of safe_asterisk.

The first works as it should, but the second keeps creating new instances of Asterisk. These new instances all fail, because port 4569 is already in use, so chan_iax2.so fails loading.

Calling "/etc/init.d/asterisk stop" only stops one instance, so I have to call it twice.

I know I shouldn't call the init script twice, but it sometimes happens by mistake, and that makes things quite confusing.

I am no init script expert, but I think the problem is that safe_asterisk is a shell script, and this is the reason that a pid file is not created in /var/run/safe_asterisk.pid.

If I uncomment the part about safe_asterisk and just let the script start asterisk directly, I get the error "Unable to open pid file '/var/run/asterisk.pid': Permission denied", probably because the asterisk user cannot write pid files here.


A related issue: If Asterisk cannot start at all, e.g. because zaptel is not loaded, the init script still says "Starting asterisk: [ OK ]" even though it isn't started. safe_asterisk just keeps restarting Asterisk without much success. I believe it should fail right away with an error message instead of trying to restart Asterisk over and over again.
Comments:By: Kevin P. Fleming (kpfleming) 2005-08-22 17:19:59

You'll have to find some other interested users on the mailing lists to help you get the script re-written if that is what is needed. Once you have a modified script that has been tested and works the way you have described, you can reopen this bug and post the patch.