Running the script as: ./fwconsole_restart.sh works perfectly
Running the same script from root crontab with perms 755 to run
fwconsole restart fails with (and the results are the same with either no #!/bin/bash or adding #!/bin/bash to the top of the script)
/usr/bin/env: pidof: No such file or directory Asterisk not currently running Running FreePBX shutdown... /usr/bin/env: pidof: No such file or directory Running FreePBX startup... Starting Asterisk... [>---------------------------] < 1 sec/usr/bin/env: pidof: No such file or directory . . [Exception] Unable to connect to Asterisk. Did it start? restart [-i|--immediate] [--] [<args>]...
and have also tried to just add it to root crontab…
53 0 * * 0 /usr/sbin/fwconsole restart
55 0 * * 0 /var/lib/asterisk/bin/fwconsole restart
all do the same thing.
ssh to the server as root and run # fwconsole restart and it works exactly how it should. What am I missing here?