Automatic update modules every night script

Hello FreePBX,

At this moment we have a scipt in /etc/cron.d which updates all modules at every night at 02:00 hour.
Now I found some older update script for cron, buth rather useless big I think.
I think that something like:

fwconsole && amportal ma upgrade framework
fwconsole && amportal ma upgradeall
fwconsole && amportal r

should be enough?

By default a root user is prohibited to do cron actions without logged in in the CLI, which can be repaired with ‘requiregetty’ with visudo.

What would be FreePBXs best choice to do this the easiest way for users who want this?

With new distributions, I would think you’d want to do something like this:

fwconsole ma upgrade framework && fwconsole ma upgradeall && fwconsole restart

This way, if you have an error in fwconsole, FreePBX wouldn’t restart and you’d be able to troubleshoot from the GUI.


That makes no sense…

you should be able to do on 13+

fwconsole ma --quiet updateall
1 Like


Ok let’s keep the update from Fpbx 13+.
Is the line:

fwconsole ma --quiet updateall

enough, or should we update framework first and after that ‘updateall’?
And if it is put in a /etc/cron.d/updatemodules script, should it be runned as root, or as asterisk user?
Many thanks for you advice by the way.

Ok I think I have a simple one-line solution to update all modules every nigt at 2 am.
What do you think about it?

1st>Update framework 2nd>update all other modules 3th> reload
At the commandline:

crontab -e

and paste the next line:

1 2 * * * sudo -u asterisk /var/lib/asterisk/bin/fwconsole ma update framework; sudo -u asterisk /var/lib/asterisk/bin/fwconsole ma updateall; sudo -u asterisk /var/lib/asterisk/bin/fwconsole r

F2 >confirm save and exit. Done…

Still looking for the difference between ‘upgradeall’ and ‘updateall’ with fwconsole command.

There is no need to update framework first. Updateall already prioritizes that.

There is no difference.