Asterisk not starting after reboot. FWConsole works fine

So I have a few PBXs running on Hyper-V. I reboot those servers on a schedule via a cron job. I also reboot any other servers on the Hyper-V host as well, at the same time. Every once in a while, I will come to find that a random PBX is booted, but asterisk is not running. A simple fwconsole start fixes this issue.

Could this be an issue where there are not enough resources at the time of startup to start asterisk properly? Perhaps it is hitting a timeout issue and giving up? If so, what would be the best way to go about resolving this? Is there a way I can (after reboot, and) check is asterisk is running, and if not, do an fwconsole start?

Try this:-

if [  -z $(pidof asterisk)  ];then /usr/sbin/fwconsole reload;fi

either at your whim or as a cronjob , which should email you when it needed to restart freepbx.

Thanks Dicko. So fwconsole reload will actually start asterisk if it isn’t running? I thought that would only reload the dial plan.

you’re probably correct, replace reload with start (or restart)

Well, that did the trick. I just tried it on my test box. Thanks!

1 Like

Follow up… This works beautifully. Scheduled via cron, that calls a script. Thanks again.

1 Like

This is a bandaid. You should try and figure out why it is crashing.

reload is technically correct because it will run the hooks to stop node modules etc and start them again after asterisk is running.

making the above a script that is called from cron can allow you to log the time when it has failed so you can look at logs.

Have you seen this behavior before? This is a new FPBX15 distro install. Which log is best to check for this?

I would start with /var/log/asterisk/full and see if asterisk is complaining about something around crash time

Then /var/log/messages to see if the system is complaining about anything around crash time.

I have seen Asterisk crash a lot, I have been around over a decade though :slight_smile: Lately it isn’t much of a problem. I would typically point to hardware (lacking memory?) but I have no anecdotal or empirical evidence to give an educated guess. These days it is all generally stable…

While you were replying, I did search /var/log/message and found this:

Nov 24 03:07:51 2101 systemd: Failed to start FreePBX VoIP Server.
Nov 24 03:07:51 2101 systemd: Unit freepbx.service entered failed state.
Nov 24 03:07:51 2101 systemd: freepbx.service failed.
Nov 24 03:07:51 2101 systemd: Reached target Multi-User System.
Nov 24 03:07:51 2101 systemd: Starting Update UTMP about System Runlevel Changes…
Nov 24 03:07:51 2101 systemd: Started Update UTMP about System Runlevel Changes.

Before you restart fwconsole, you can check on failure reason with

systemctl status fwconsole

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.