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

I have the same issue from this morning.

Same issue here.

Current PBX Version:
15.0.17.64
Current System Version:
12.7.8-2107-3.sng7

Same problem as documented in this thread. Basically FreePBX pushed an untested and broken module to your PBX. You will need to either wait for a fix, presumably next Friday, or manually revert the module. It is not a real killer but an incredibly incompetent release

Same here

FreePBX 15.0.17.64

Started after this mornings automated module updates, now recieving an email every 15 minutes from our FreePBX server.

Please advise.

Did you read this thread ?

Could someone please advise how to go back to the previous version.

1 Like

It might be a little more complicated than that, because the previous module didn’t inject a crontab and the broken one might not remove it on being ‘replaced’.

Any takers here?

1 Like

Using WinSCP I can see the relevant entry (the last line) in file /var/spool/cron/asterisk so I can delete it.

Would not then a rollback be adequate?

That would take some regression testing, ask FreePBX but they are currently not exactly A+ on that right now. Why not suck it and see. let us know how it worked out.

I’m happy to try but don’t know how to roll it back.

Since it seems the entire Sangoma team doesn’t care about anything outside of M-F 8-5…

I upgraded one of my PBX systems last night. I was not having any issues prior to the upgrade.

'userman' from 16.0.25.18 to 16.0.25.28

Now I have the 15 minute cron error.

[jbusch@pbx ~]$ sudo -u asterisk crontab -l
[sudo] password for jbusch: 

*/15 * * * * [ -e /etc/asterisk/firewall.enabled ] && touch /var/spool/asterisk/incron/firewall.firewall
*/15 * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM\%30)) && /usr/sbin/fwconsole userman --syncall -q
* 3 * * * /usr/sbin/fwconsole util cleanplaybackcache -q
9 19 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma listonline --sendemail -q > /dev/null 2>&1
9 20 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole sys listonline --sendemail -q > /dev/null 2>&1
* * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM\%30)) && /usr/sbin/fwconsole job --run --quiet 2>&1 > /dev/null

I checked edge, and there was an update to .29

| userman             | 16.0.25.28 | Online upgrade available (16.0.25.29)     | AGPLv3+     |
sudo fwconsole ma upgrade userman --edge
sudo fwconsole reload

And still a screwed up crontab.

*/15 * * * * [ -e /etc/asterisk/firewall.enabled ] && touch /var/spool/asterisk/incron/firewall.firewall
*/15 * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM\%30)) && /usr/sbin/fwconsole userman --syncall -q
* 4 * * * /usr/sbin/fwconsole util cleanplaybackcache -q
47 17 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma listonline --sendemail -q > /dev/null 2>&1
47 18 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole sys listonline --sendemail -q > /dev/null 2>&1
* * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM\%30)) && /usr/sbin/fwconsole job --run --quiet 2>&1 > /dev/null

Here are the known rollback options for FreePBX 16. I’ll start with .18 as that is where I came from.
image

sudo fwconsole ma downloadinstall userman --tag=16.0.25.18
sudo fwconsole reload

It removed the userman cron line.

[jbusch@pbx ~]$ sudo -u asterisk crontab -l

*/15 * * * * [ -e /etc/asterisk/firewall.enabled ] && touch /var/spool/asterisk/incron/firewall.firewall
* * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM\%30)) && /usr/sbin/fwconsole job --run --quiet 2>&1 > /dev/null
* 2 * * * /usr/sbin/fwconsole util cleanplaybackcache -q
36 19 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole ma listonline --sendemail -q > /dev/null 2>&1
36 20 * * * [ -e /usr/sbin/fwconsole ] && /usr/sbin/fwconsole sys listonline --sendemail -q > /dev/null 2>&1

My last failure was at 6:15PM. It is now 6:24PM. I’ll know in a few minutes.
image

I am on 15: Upgrading module ‘userman’ from 15.0.63 to 15.0.65

The FreePBX docs say ‘Starting in version 12 you can downgrade module versions from Modue Admin.’ but my V15 Module Admin does not show a ‘Previous’ option.

You have to click check online before that becomes visible.

Not really surprised, it still comes in.
image

On a FreePBX distro

ls -l $(cat /etc/shells) 

revealing that /bin/sh is an alias of /bin/bash , from a bash shell try

bash --version
echo $((RANDOM\%30))
echo $((RANDOM%30)) 
echo $((${RANDOM} % 30)) 

Now the second and the third should work fine , the third one would be what I would use for clarity, as the $(( )) does the math so ${RANDOM} is ‘modulo’ed’ 30. But is there any way that unnecessarily ‘escaping’ the modulus operator in the first on will ever get to performing the operation after && ?

Thank you - worked.

On CRON jobs list this time there were actually two similar jobs: one running every minute and the other every 15. I deleted both.

It is a couple of hours later and there have been no messages and the two Cron lines I deleted have not come back.

All seems to be OK.

probably a mistake to not run /usr/sbin/fwconsole job --run regularly, read why above in this thread.

Thank you. I assumed whatever needs to be there would be put back automatically (I don’t remember seeing the minute-timer version originally but could well be wrong).

I have an other system running and that has not been upgraded - still on 15.0.63

So I have copied back the cron line from there.

* * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM\%30)) && /usr/sbin/fwconsole job --run --quiet 2>&1 > /dev/null

https://issues.freepbx.org/browse/FREEPBX-23162

I’ve just gone thru the process on a 15 system to determine how one might roll back to the most recent version without the crontab issue. There is a lot in this thread, and it’s possible this may have already been shared.

Starting with the current stable 15 version, you can see the problem line is here:

# grep RANDOM /var/www/html/admin/modules/userman/Userman.class.php
            $freepbxCron->addLine("*/15 * * * * [ -e ".$AMPSBIN."/fwconsole ] && sleep $((RANDOM%30)) && ".$AMPSBIN."/fwconsole userman --syncall -q");

I downgrade to 15.0.63 using this command:

# fwconsole ma downloadinstall userman --tag 15.0.63
# fwconsole r

And once that’s downloaded, I can confirm the problem line is not present in the userman module code:

# grep RANDOM /var/www/html/admin/modules/userman/Userman.class.php
<< null >>

However, the crontab entry remains, and the fwconsole job is not present as expected:

# fwconsole job --list | grep userman
# crontab -l -uasterisk | grep userman
    */15 * * * * [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM%30)) && /usr/sbin/fwconsole userman --syncall -q

At this point reinstalling the module fixes those tasks:

# fwconsole ma install userman

Which we can confirm with:

# crontab -l -uasterisk | grep userman
# fwconsole job --list | grep userman
    | 45 | userman              | syncall                | */15 * * * * | 2021-12-19 13:15:00 | Class: FreePBX\modules\Userman\Job                                                                                                     | Yes     

Now chown (prob not necessary) and reload:

# fwconsole chown
# fwconsole r