Cron Job to Apply Config Changes?

Hi,

Although I see a number of suggestions on how to apply config changes via command line, I am unclear as to which one really does the trick. What I am looking to do is to have a cron job run every morning at 4:30 am to apply any pending FreePBX configuration changes.

Has anyone else done this or could someone point me in the right direction?

Thanks!

‘amportal reload’ or /var/lib/asterisk/bin/retreive_conf

They both do the same thing.

Hi, I added the following entry to my crontab because I would like to auto-apply pending configuration changes every day at 3:00 AM. But, when it runs via either crontab or via manual command entry, the orange “Apply Configuration Changes” indicator is still present in the FreePBX web interface. If it is needed knowledge, I am currently running FreePBX 2.9.0.12. Thanks!

0 3 * * * /var/lib/asterisk/bin/retrieve_conf

Is it calling the script?

Tell you what I would do, create a shell script - timed_reload with the following code:

echo "Time Reload Executing At: $(date)" >> /var/log/messages
/var/lib/asterisk/bin/retrieve_conf >> messages
echo "Reload script exiting at: $(date)" >> /var/log/messages

I am sure someone else will have something more elegant but this gets the job done.

Scott

I created a shell script:
#!/bin/sh
echo “Time Reload Executing At: $(date)” >> /var/log/messages
/var/lib/asterisk/bin/retrieve_conf >> messages
echo “Reload script exiting at: $(date)” >> /var/log/messages

but it did not work… :frowning:

Ok, I will bite, what part did not work?

I see an error, forgot the full path on line 2, should be:

/var/lib/asterisk/bin/retrieve_conf >> /var/log/messages

Other than that I just ran it and it works fine. Frankly you should have caught my error.

“Didn’t work” means that the orange bar is still showing in FreePBX after executing the script.

/var/lib/asterisk/bin/module_admin reload

That worked, thanks!

This is the script I run:

#!/bin/sh
echo “Time Reload Executing At: $(date)” >> /var/log/messages
/var/lib/asterisk/bin/retrieve_conf >> /var/log/messages
echo “Finished Retrieving Conf At: $(date)” >> /var/log/messages
/var/lib/asterisk/bin/module_admin reload >> /var/log/messages
echo “Reload script exiting at: $(date)” >> /var/log/messages

how to implement this script when should i past this script i am trying lot but i am not getting how to implement.

#!/bin/sh
echo “Time Reload Executing At: $(date)” >> /var/log/messages
/var/lib/asterisk/bin/retrieve_conf >> /var/log/messages
echo “Finished Retrieving Conf At: $(date)” >> /var/log/messages
/var/lib/asterisk/bin/module_admin reload >> /var/log/messages
echo “Reload script exiting at: $(date)” >> /var/log/messages

how to implement the script

in which file we need to add this script

A new file with execute permissions.

Or simply amportal a r will do both a retrieve_conf then a reload. All in one command.

Typically our CPU load is sitting between 0 and 3%.
During an “amportal a r”, CPU load jumps between 70 and 90%.

Is this normal?

We are running FreePBX Distro:
PBX Firmware: 3.211.63-9
PBX Service Pack: 1.0.0.0
FreePBX: 2.11.0.10
Asterisk: 10.12.2

Depends on your system but yes. There is a ton of processing to be done during that time.

Also you are most-likely seeing spikes in CPU.

please give me some examples