Mult emals - Cron <asterisk@24408486> [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM

This was also a fix that I think @dicko proposed which was run all cron jobs under one cron task so that CPU load of launching PHP 20x times would not take down a system, instead PHP would launch once and then all the processes that needed to cron would be done at the same time utilizing the same “shared” memory and CPU and reducing overall load on the system.

This is in-fact how other PHP Frameworks do scheduling like Laravel

The job manger (/usr/sbin/fwconsole job --run) itself has to run in the cron every minute. $((RANDOM%30)) is there because of PBXact in the cloud where-as they all use the same storage so every top of the minute there was a large spike of I/O. Randomizing this with a sleep solves the issue of disk I/O but unfortunately it doesn’t translate to other distros well.

The Job functionality in FreePBX is also poorly documented because when I started working on this was right around the time Tony Lewis announced he was leaving and it was pretty chaotic.

Sidebar: Im sorry to shoot everyone who does this in the foot but PBXact and FreePBX don’t scale well in cloud environments because they are single tenant and FreePBX has expectations that it is running on its own dedicated hardware. This is one (of the many) reasons why.

5 Likes