Can't get into console - asterisk.ctl does not exist

I am running asterisk 1.2 on CentOS 4.5.

I am (or was actually) unable to get into the asterisk console. I was also getting some errors on my web inteface (amportal I think?) that “/opt/var/run/asterisk.ctl does not exist.” And when I run asterisk -r I get an error. I confirmed that the /opt/var/run/asterisk.ctl indeed does not exist. I can still make all calls fine.

If I manually start asterisk using safe_asterisk, the file is there, and the console works. But when using the “service start asterisk” command, or when the server first boots up, the .ctl file is not there.

I removed this line from the “start” section of /etc/rc.d/init.d/asterisk:
[ $RETVAL -eq 0 ] && rm -f /var/run/asterisk/asterisk.ctl
And now everything works fine. Why was the startup file removing the asterisk.ctl? I suspect something else is going on. Here are the last 6 lines of the “start” section of the init file:

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
#[ $RETVAL -eq 0 ] && rm -f /var/run/asterisk/asterisk.ctl - I commented this line out
return $RETVAL

It looks like its suppsed to remove the asterisk.ctl file when everything starts up successfully? How would that work?

Usually, the asterisk.ctl file is only readable by root, but safe_asterisk probably fixes that.

As to the reason why it was being removed by your init script, I think only Redhat support can answer that question. :smile: