/var/lib/asterisk/bin/freepbx_engine Errors

Not sure where to put this.
PIAF install running FreePBX 2.11.

I’m looking through /var/mail/root and I’m seeing
/var/lib/asterisk/bin/freepbx_engine: line 335: pidof: command not found
/var/lib/asterisk/bin/freepbx_engine: line 308: pidof: command not found
/var/lib/asterisk/bin/freepbx_engine: line 289: pidof: command not found

Line 289: pid_length=$PIDOF asterisk|awk '{print length($0)}'
Line 308: pid_length=$PIDOF asterisk|awk '{print length($0)}'
Line 335: pid_length=$PIDOF asterisk|awk '{print length($0)}'

I’m assuming this is important?

Now it is possible it has something to do with having cron launch a script to restart Asterisk. The script works when manually run but not when launched via cron. I’ve made sure cron runs as root and I’m using the full path to amportal. That’s what led me here.

cron jobs usually run under the restricted shell sh, this is not bash and you might need to fully qualify ALL programs called by your script. e.g. /bin/pidof an not just pidof.

The script is simply calling an amportal restart. Also, it seems to me that the pidof that is being referenced is actually a variable, not a command, since it has the $ preceding it.

It is a variable, linux is case sensitive, from /var/lib/asterisk/bin/freepbx_engine

if [ -z $PIDOF ]; then

That might have better been expressed as be PIDOF=$(/usr/bin/which pidof), but when :-

sudo -u asterisk sh /full/path/yourscript

works . . . .

(to clarify, PIDOF is a variable, pidof is a binary, it needs to be accessible to your script to run)