Search code examples
phpsymfonycronovh

OVH CRON: How to execute a Symfony command?


How to execute a Symfony command with OVH cron?
I created a command on my symfony project:

php bin/console cron:test

I defined my Cron in the OVH table "Scheduled Tasks - Cron":

  • Command: cron/test.sh
  • Language: Other

test.sh is executable (chmod 700).

In test.sh I do not know what to write.
I tested several code found on the internet without success, including this one (with a php file): OVH cron jobs / Symfony Command

I am using php 7.1. What is the logic that applies to find this code? Thanks in advance for the help.


Solution

  • I got my answer. Thank you @Tomasz for your help.
    phpinfo() showed me the way.
    The solution:

     #!/bin/bash 
    /usr/local/php7.1/bin/php /homez.ovhNumber/myWebsite/symphonyProject/bin/console cron:test