Difference between revisions of "FreePBX 60 seconden fix"
4allbusiness (talk | contribs) |
4allbusiness (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 49: | Line 49: | ||
Dus Cronjob asterisk /var/spool/cron | Dus Cronjob asterisk /var/spool/cron | ||
+ | |||
+ | Orgineel van een Sangoma hosted PBX, ik vermoed een verschil, met name de */15 van Firewall en userman | ||
+ | */1 * * * * /var/lib/asterisk/bin/pagepro-scheduler.php 2>&1 >/dev/null | ||
+ | @daily [ -x /var/lib/asterisk/agi-bin/update_license.php ] && /var/lib/asterisk/agi-bin/update_license.php --delay | ||
+ | @daily [ -x /var/lib/asterisk/bin/freepbx_sipstation_check ] && /var/lib/asterisk/bin/freepbx_sipstation_check | ||
+ | * * * * * [ -x /var/www/html/admin/modules/dashboard/scheduler.php ] && /var/www/html/admin/modules/dashboard/scheduler.php > /dev/null 2>&1 | ||
+ | 27 * * * * /usr/sbin/fwconsole util cleanplaybackcache -q | ||
+ | */1 * * * * /usr/sbin/fwconsole calendar --sync 2>&1 > /dev/null | ||
+ | */15 * * * * [ -e /etc/asterisk/firewall.enabled ] && touch /var/spool/asterisk/incron/firewall.firewall | ||
+ | @daily /usr/sbin/fwconsole pms mk_dirty > /dev/null 2>&1 | ||
+ | * * * * * /usr/sbin/fwconsole pms wu_alert > /dev/null 2>&1 | ||
+ | */5 * * * * /usr/sbin/fwconsole qxactreports --sync -q 2>&1 > /dev/null | ||
+ | 30 22 * * * /usr/sbin/fwconsole recordingreports -s -c -q > /dev/null 2>&1 | ||
+ | 0 0 1 * * php /var/lib/asterisk/agi-bin/backuprecordings.php > /dev/null 2>&1 | ||
+ | 13 2 * * * /usr/sbin/fwconsole certificates --updateall -q 2>&1 >/dev/null | ||
+ | * * * * * [ -x /var/lib/asterisk/bin/schedtc.php ] && /var/lib/asterisk/bin/schedtc.php | ||
+ | @daily [ -e /var/www/html/admin/modules/sysadmin/bin/check_portal.php ] && /var/www/html/admin/modules/sysadmin/bin/check_portal.php >/dev/null 2>&1 | ||
+ | @daily [ -x /var/lib/asterisk/agi-bin/ddns_client.php ] && /var/lib/asterisk/agi-bin/ddns_client.php >/dev/null 2>&1 | ||
+ | @hourly [ -x /var/lib/asterisk/bin/storage.php ] && /var/lib/asterisk/bin/storage.php >/dev/null 2>&1 | ||
+ | */15 * * * * /usr/sbin/fwconsole userman --syncall -q | ||
+ | 5 6 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma listonline --sendemail -q > /dev/null 2>&1 | ||
+ | 5 7 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole sys listonline --sendemail -q > /dev/null 2>&1 | ||
+ | 28 3 * * * /usr/sbin/fwconsole certificates --updateall -q 2>&1 >/dev/null | ||
+ | |||
+ | |||
+ | |||
[root@4ab cron]# cat asterisk | [root@4ab cron]# cat asterisk | ||
Line 77: | Line 103: | ||
SED commando om alles te wijzigen naar random | SED commando om alles te wijzigen naar random | ||
− | sed -i 's/\* \* \* \* \* \/usr/\* \* \* \* \* sleep $(( ( RANDOM % 30 ) + 1 )) \&\& \/usr/g' /var/spool/cron/asterisk | + | sed -i 's/\* \* \* \* \* \/usr/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& \/usr/g' /var/spool/cron/asterisk |
− | sed -i 's/\* \* \* \* \* php/\* \* \* \* \* sleep $(( ( RANDOM % 30 ) + 1 )) \&\& php/g' /var/spool/cron/asterisk | + | sed -i 's/\* \* \* \* \* php/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& php/g' /var/spool/cron/asterisk |
− | sed -i 's/\* \* \* \* \* \[/\* \* \* \* \* sleep $(( ( RANDOM % 30 ) + 1 )) \&\& \[/g' /var/spool/cron/asterisk | + | sed -i 's/\* \* \* \* \* \[/\* \* \* \* \* sleep $(( ( RANDOM % \\30 ) + 1 )) \&\& \[/g' /var/spool/cron/asterisk |
− | sed -i 's/\*\/1 \* \* \* \* var/\* \* \* \* \* sleep $(( ( RANDOM % 30 ) + 1 )) \&\& var/g' /var/spool/cron/asterisk | + | sed -i 's/\*\/1 \* \* \* \* var/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& var/g' /var/spool/cron/asterisk |
− | sed -i 's/\* \* \* \* \* var/\* \* \* \* \* sleep $(( ( RANDOM % 30 ) + 1 )) \&\& var/g' /var/spool/cron/asterisk | + | sed -i 's/\* \* \* \* \* var/\* \* \* \* \* sleep $(( ( RANDOM % \\30 ) + 1 )) \&\& var/g' /var/spool/cron/asterisk |
− | sed -i 's/\*\/5 \* \* \* \* \/usr/\* \* \* \* \* sleep $(( ( RANDOM % 30 ) + 1 )) \&\& \/usr/g' /var/spool/cron/asterisk | + | sed -i 's/\*\/5 \* \* \* \* \/usr/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& \/usr/g' /var/spool/cron/asterisk |
sed -i '/\* \* \* \* \* \/usr/d' /var/spool/cron/asterisk | sed -i '/\* \* \* \* \* \/usr/d' /var/spool/cron/asterisk | ||
sed -i '/\* \* \* \* \* php/d' /var/spool/cron/asterisk | sed -i '/\* \* \* \* \* php/d' /var/spool/cron/asterisk |
Latest revision as of 08:10, 21 May 2019
FreePBX heeft een 60 seconden CRON bug gekregen in versie 12, 13, 14. Er zijn een aantal zaken die gewijzigd dienen te wordne om op hoisting servers meer dan 15 PBXen te kunnen hosten, zonder dat ze allemaal elke hele minuut iets uitvoeren, waardoor ze allemaal een slechte geluidskwaliteit hebben.
Een aantal zaken staan beschreven, maar een aantal ook niet. In maart 2019 is dit uitgebreid besproken, maar nog niet echt opgelost, er zijn wel een aantal zaken verandert.
Na te kijken vanaf CLI Elke minuut cron kan aangepast worden, of uitgezet worden
crontab -e -u asterisk
BouW een random sleep in door
* * * * * uittevoerencommando
te vervangen voor
* * * * * sleep $(( ( RANDOM % 50 ) + 1 )) && uittevoerencommando
of zet de minuut cron uit waar het kan door er een hekje # voor te zetten
Enkele improvements voor Fpbx 14 vanaf maart 2019 Vervang AGI door FASTAGI
clear #Setting instellen via commandline #fwconsole setting -l voor optie's #enable fastagi - default in 15 disabled in 14 #eerst core updaten per maart 2019 #60sec dashboard fix per 6mrt2019 in edge modus fwconsole ma --edge update core fwconsole ma --edge update framework fwconsole ma --edge update dashboard fwconsole setting LAUNCH_AGI_AS_FASTAGI 1 fwconsole setting SYS_STATS_DISABLE 1 fwconsole r fwconsole restart # #60sec stats uitschakelen ivm hostingproblemen fwconsole setting SYS_STATS_DISABLE 1 #Overige 4Ab Settings fwconsole reload fwconsole restart
Deze fix is leuk, maar lost het hele probleem nog niet op. Er zijn nog steeds een aantal cronjobs die elke minuuut eprden uitgevoerd en problemen geven.
Deze kunnen we oplossen door een random sleep in te bouwen in de cronjob.
Dit is getest en het werkt!!
Voro de sleeprandom fix is het maximum CPU 100% elke minuut. Na de Sleeprandom fix is het maximum CPU nog maar 28%
Voorbeeld van Cronjob voor en na. Bij elke minuut cronjob wordt toegevoegd: Een random sleep van 40 seconden
sleep $(( ( RANDOM % 40 ) + 1 )) &&
Dus Cronjob asterisk /var/spool/cron
Orgineel van een Sangoma hosted PBX, ik vermoed een verschil, met name de */15 van Firewall en userman
*/1 * * * * /var/lib/asterisk/bin/pagepro-scheduler.php 2>&1 >/dev/null @daily [ -x /var/lib/asterisk/agi-bin/update_license.php ] && /var/lib/asterisk/agi-bin/update_license.php --delay @daily [ -x /var/lib/asterisk/bin/freepbx_sipstation_check ] && /var/lib/asterisk/bin/freepbx_sipstation_check * * * * * [ -x /var/www/html/admin/modules/dashboard/scheduler.php ] && /var/www/html/admin/modules/dashboard/scheduler.php > /dev/null 2>&1 27 * * * * /usr/sbin/fwconsole util cleanplaybackcache -q */1 * * * * /usr/sbin/fwconsole calendar --sync 2>&1 > /dev/null */15 * * * * [ -e /etc/asterisk/firewall.enabled ] && touch /var/spool/asterisk/incron/firewall.firewall @daily /usr/sbin/fwconsole pms mk_dirty > /dev/null 2>&1 * * * * * /usr/sbin/fwconsole pms wu_alert > /dev/null 2>&1 */5 * * * * /usr/sbin/fwconsole qxactreports --sync -q 2>&1 > /dev/null 30 22 * * * /usr/sbin/fwconsole recordingreports -s -c -q > /dev/null 2>&1 0 0 1 * * php /var/lib/asterisk/agi-bin/backuprecordings.php > /dev/null 2>&1 13 2 * * * /usr/sbin/fwconsole certificates --updateall -q 2>&1 >/dev/null * * * * * [ -x /var/lib/asterisk/bin/schedtc.php ] && /var/lib/asterisk/bin/schedtc.php @daily [ -e /var/www/html/admin/modules/sysadmin/bin/check_portal.php ] && /var/www/html/admin/modules/sysadmin/bin/check_portal.php >/dev/null 2>&1 @daily [ -x /var/lib/asterisk/agi-bin/ddns_client.php ] && /var/lib/asterisk/agi-bin/ddns_client.php >/dev/null 2>&1 @hourly [ -x /var/lib/asterisk/bin/storage.php ] && /var/lib/asterisk/bin/storage.php >/dev/null 2>&1 */15 * * * * /usr/sbin/fwconsole userman --syncall -q 5 6 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma listonline --sendemail -q > /dev/null 2>&1 5 7 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole sys listonline --sendemail -q > /dev/null 2>&1 28 3 * * * /usr/sbin/fwconsole certificates --updateall -q 2>&1 >/dev/null
[root@4ab cron]# cat asterisk @daily [ -e /var/www/html/admin/modules/sysadmin/bin/check_portal.php ] && /var/www/html/admin/modules/sysadmin/bin/check_portal.php @daily [ -x /var/lib/asterisk/agi-bin/ddns_client.php ] && /var/lib/asterisk/agi-bin/ddns_client.php 18 * * * * /usr/sbin/fwconsole util cleanplaybackcache -q */1 * * * * sleep $(( ( RANDOM % 40 ) + 1 )) && var/lib/asterisk/bin/pagepro-scheduler.php 2>&1 >/dev/null @weekly ID=freepbx_backup_1 /var/lib/asterisk/bin/backup.php --id=1 >/dev/null 2>&1 */15 * * * * [ -e /etc/asterisk/firewall.enabled ] && touch /var/spool/asterisk/incron/firewall.firewall 30 0 * * * /usr/sbin/fwconsole certificates --updateall -q 2>&1 >/dev/null @daily [ -e /var/www/html/admin/modules/sysadmin/bin/check_portal.php ] && /var/www/html/admin/modules/sysadmin/bin/check_portal.php >/dev/null 2>&1 */15 * * * * /usr/sbin/fwconsole userman --syncall -q @daily /usr/sbin/fwconsole pms mk_dirty > /dev/null 2>&1usr/usr/sbin/fwconsole pms wu_alert > /dev/null 2>&1 * * * * * sleep $(( ( RANDOM % 40 ) + 1 )) && /usr/sbin/fwconsole queuestats --syncall >> /tmp/reader.log 2>&1 */5 * * * * sleep $(( ( RANDOM % 40 ) + 1 )) && /usr/sbin/fwconsole qxactreports --sync -q 2>&1 > /dev/null2 @daily [ -x /var/lib/asterisk/bin/freepbx_sipstation_check ] && /var/lib/asterisk/bin/freepbx_sipstation_check 2>&1 > /dev/null 30 22 * * * /usr/sbin/fwconsole recordingreports -s -c -q > /dev/null 2>&1 0 0 1 * * php /var/lib/asterisk/agi-bin/backuprecordings.php > /dev/null 2>&1 */3 * * * * [ -x /var/lib/asterisk/bin/schedtc.php ] && /var/lib/asterisk/bin/schedtc.php */1 * * * * sleep $(( ( RANDOM % 40 ) + 1 )) && /usr/sbin/fwconsole calendar --sync 2>&1 > /dev/null @hourly [ -x /var/lib/asterisk/bin/storage.php ] && /var/lib/asterisk/bin/storage.php >/dev/null 2>&1 @daily [ -x /var/lib/asterisk/agi-bin/update_license.php ] && /var/lib/asterisk/agi-bin/update_license.php --delay 26 1 * * 2 /var/lib/asterisk/bin/queue_reset_stats.php --id=260 * * * * * sleep $(( ( RANDOM % 40 ) + 1 )) && [ -x /var/www/html/admin/modules/dashboard/scheduler.php ] && /var/www/html/admin/modules/dashboard/scheduler.php > /dev/null 2>&1 59 6 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma listonline --sendemail -q > /dev/null 2>&1 59 8 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma installall --sendemail -q > /dev/null 2>&1 * * * * * sleep $(( ( RANDOM % 40 ) + 1 )) && php /var/lib/asterisk/bin/vqplus_generate_periodical_events.php > /dev/null 2>&1
SED commando om alles te wijzigen naar random
sed -i 's/\* \* \* \* \* \/usr/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& \/usr/g' /var/spool/cron/asterisk sed -i 's/\* \* \* \* \* php/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& php/g' /var/spool/cron/asterisk sed -i 's/\* \* \* \* \* \[/\* \* \* \* \* sleep $(( ( RANDOM % \\30 ) + 1 )) \&\& \[/g' /var/spool/cron/asterisk sed -i 's/\*\/1 \* \* \* \* var/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& var/g' /var/spool/cron/asterisk sed -i 's/\* \* \* \* \* var/\* \* \* \* \* sleep $(( ( RANDOM % \\30 ) + 1 )) \&\& var/g' /var/spool/cron/asterisk sed -i 's/\*\/5 \* \* \* \* \/usr/\* \* \* \* \* sleep $(( ( RANDOM \\% 30 ) + 1 )) \&\& \/usr/g' /var/spool/cron/asterisk sed -i '/\* \* \* \* \* \/usr/d' /var/spool/cron/asterisk sed -i '/\* \* \* \* \* php/d' /var/spool/cron/asterisk sed -i '/\* \* \* \* \* \[/d' /var/spool/cron/asterisk sed -i '/\*\/1 \* \* \* \* var/d' /var/spool/cron/asterisk sed -i '/\* \* \* \* \* var/d' /var/spool/cron/asterisk sed -i '/\*\/5 \* \* \* \* \/usr/d' /var/spool/cron/asterisk #