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":
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.
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
In command field you should be able to enter command you want to execute. But because you don't know from where it will be executed you have to specify full path to command for example:
php /var/www/my-project/bin/console cron:test
But, I'm not familiar with OVH Tools so if you need to create bash file which will be run by cron, then your file should like like this:
#!/bin/bash
php /var/www/my-project/bin/console cron:test
Here is the same principal with the full path to your bin/console
file.