Cron error after upgrade to version 16

Hi,

After an upgrade from version 15 to 16, some cron errors are generated at midnight:

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

sh: ifconfig: command not found

NB: no error during the upgrade process

Any help is welcome.
André

What OS?

Linux-3.10.0-1127.19.1.el7.x86_64-x86_64-with-centos-7.8-Source

V15 installed with the Freepbx distro.

If it is Distro then it came with ifconfig.

Here is the kernel version info:

Linux 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

So yours “with-centos-7.8-Source” is different – not Distro.

100% installed from distro 2 years ago and indeed ifconfig is installed.

But error during the run under cron…

which ifconfig

[root@pbx /]# which ifconfig
/usr/sbin/ifconfig
[root@pbx /]# uname -a
Linux pbx.xxx 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

su asterisk  -c 'echo $PATH'

[root@pbx /]# ll /usr/sbin/ifconfig
-rwxr-xr-x 1 root root 81976 Aug 9 2019 /usr/sbin/ifconfig
[root@pbx /]# su asterisk -c ‘echo $PATH’
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

I have a Distro 16 system that was upgraded last weekend that is doing this. I have not done any troubleshooting yet as everything else seems working

Running fwconsole job --run at the command line should reveal the offender.

Doing a grep of the FreePBX code shows a number of places where ifconfig is used.

[asterisk@pbx /]$ fwconsole job --run
Running pagingpro::scheduler…Done
Running calendar::sync…Starting Calendar Sync…
Finished
Done
Running qxact_reports::sync…Done
Running dashboard::scheduler…Done
Running timeconditions::schedtc…==Working with TimeCondition:Business hours==
INVERTED BLF: false (NOT_INUSE = NOT_INUSE & INUSE = INUSE)
OVERRIDE MODE: not set
TIME MATCHED: True (NOT_INUSE)
BLF MODE: True (NOT_INUSE)
Privilege: Command
Changing TC1 to NOT_INUSE

Done
Running userman::syncall…Directory ‘PBX Internal Directory’ does not support syncing
Directory ‘HPMS’ does not support syncing
Done
Running pms::wu_alert…Done

Freepbx 16 running now for 10 days.

Still the daily error message but everything else seems working perfectly

“ifconfig” error is coming due to using 3rd party library. Ref - [FREEPBX-22970] FreePBX 16 > sh: ifconfig: command not found - Sangoma Issue Tracker

A github pr i.e. add option to be able to specify the ipconfig path. by vsc55 · Pull Request #3 · BlakeGardner/php-mac-address · GitHub is up to fix this issue in that 3rd party lib so waiting for that to get merge so we can pull the latest code.

thanks.

same issue after upgrade to v16 . this should fix

cd /usr/local/bin
ln -s /usr/sbin/ifconfig

the cronjob occurs around midnight. this shows it s/b fixed. time will tell:

su asterisk  -c ifconfig

Edit: cronjob still has the issue.

Subject: Cron <asterisk@freepbx-16> [ -e /usr/sbin/fwconsole ] && sleep $((RANDOM%30)) && /usr/sbin/fwconsole job --run --quiet 2>&1 > /dev/null

sh: ifconfig: command not found

so need to fix PATH in the crontab used for the job

A new version of sysadmin module i.e. v16.0.6.4 has been pushed to EDGE with this issue fix.

Refer to - [FREEPBX-22970] FreePBX 16 > sh: ifconfig: command not found - Sangoma Issue Tracker

Good that a new version is on the way.
in the mean adding PATH line solves the issue:

# crontab -l -u asterisk 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin