Run bash command during reload config

Is it possible to have a bash script run when the fwconsole reload or “apply config” button is pressed?

I currently have a daily cron job that pulls user data out of the database for a phone directory and while this works, if I could have it hooked to a config reload it would be preferred.

I saw some threads about doing a custom module (which would then be called during a config reload) but that seems like a lot of overhead for what amounts to a simple mysql CSV export.

A custom module doesn’t have to be overly involved

Example:

1 Like

You could also just monitor files in /etc/asterisk for changes (such as extensions_additional.conf) and use that to trigger your job.
Or use a log monitoring tool like SEC to monitor the asterisk log for a reload and trigger the job.

Thanks for the ideas. I’ll give them a shot!

Try adding an incron job incrontab -e

/etc/asterisk/voicemail.conf IN_CLOSE_WRITE /your/script/name.sh

There are PRE and POST reload script hooks in advanced settings.

Update to the edge framework first.

2 Likes

I had been doing similar, because the post-reload script broke somewhere along the way and I was too lazy to file a bug report.

This post prompted me to post a report(and planned to post a PR), only to find out it was fixed in the newest edge version of Framework 15.0.17.27.

Timing is everything.

1 Like

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