Startup code


#1

I’m interested in running some code inside of asterisk whenever Asterisk starts. I am running Asterisk on a VM which makes it easy to spin up new instances. So, whenever a new instance is started I want it to announce itself to a central database. I’d also use this to alert me whenever Asterisk crashes and restarts itself.

Are there any hooks in Asterisk that allow me to do this? I suppose I could put it into the init.d script, but that wouldn’t help me whenever it crashed.

Thanks
Kevin Reeves


#2

What Linux distribution are you using? In CentOS anything in rc.local will run at boot time.

I have a perl script that I run about 5 minutes after boot on most all my Linux servers to send me some vitals. By default, this could also serve as a notice that your server rebooted.


#3

I do not think there are hooks for this and you should prevent from changing the Asterisk code itself to enable easier upgrades. You can run Asterisk via some script and this script will call other program you want.