Running cron.php from Synology's Task Scheduler as the http user

I installed SuiteCRM 7.10.11 on my Synology DS218 running “DSM 6.2-23739 Update 2”.

I had trouble working out how to run the scheduler script cron.php within the boundaries set by DSM.
After each reboot, the crontab file is written over by a default one from another part of the system.
Using the Task Scheduler is more appropriate but appears problematic because there is no http user listed.

Here is the compromise:

  • create a Task Scheduler task
  • choose root as the user
  • use the following as the Run command:
cd /volume1/web/suitecrm; sudo -H -u http bash -c 'php70 -f cron.php > /dev/null 2>&1'

Since the sudo command runs as root it will not demand password and the -c part will be executed as if the user http ran it making the cron.php work as expected and not causing any permissions issues.

php70 is not configured by default to have all the extensions required by cron.php but it can be configured to do so. That’s another post.

1 Like