Sheduler.php and cron issue

I am running into a series of issues related to workflows. I have recently upgraded to 7.9.7 due to edit issue 4401 in 7.9.6. Now I am not able to keep my cron jobs running. When I try to launch it manually via php cron.php in the site directory I am getting warnings.

Warning: A non-numeric value encountered in /var/www/sites/suitecrm/rp/modules/Schedulers/Scheduler.php on line 409

Warning: A non-numeric value encountered in /var/www/sites/suitecrm/rp/modules/Schedulers/Scheduler.php on line 412

Also I am not able to edit the crontab as indicated to change via admin/scheduler i.e.

In order to run SuiteCRM Schedulers, edit your web server user’s crontab file with this command:
sudo crontab -e -u apache
… and add the following line to the crontab file:

          • cd /var/www/sites/suitecrm/rp; php -f cron.php > /dev/null 2>&1 
            

I get an unrecognized option
crontab: invalid option – ‘-’
crontab: usage error: unrecognized option

I am logged in as Root and on Fedor23 with PHP7.

When I try to do so directly I get
no crontab for apache - using an empty one
/bin/sh: /usr/bin/vi: No such file or directory
crontab: “/usr/bin/vi” exited with status 127

Is there suppose to be a folder vi

Any assistance would be helpful. Thanks,

This is what my Ubuntu returns on crontab --help:

root@SuiteCRM:/var/www/html# crontab --help
crontab: invalid option -- '-'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

So the -u is to specify which user’s crontab you want to edit. Is there an equivalent option in your Fedora?

Then, when you edit the crontab, the system launches the deafult text editor. For me it’s nano, for you it seems to be vi… but it’s not well configured.

I suggest you try to solve that text editor problem in your system first (see answers like this one).

I got it to work with root then the remainder edited via vim. Thanks for the insight.

Ok, but make sure your cron jobs aren’t running as root, if your web server isn’t, otherwise they will write files with root ownership, and the web server won’t be able to read them. It simply doesn’t work well in that configuration.

On the other hand, you REALLY don’t want your web server running as root, so you need to get your cron jobs running as the correct user, that’s the only sensible option.

There is a guide for all this here:

https://pgorod.github.io/Scheduler-Jobs/