简体   繁体   中英

How to execute a command with a cron?

I have a problem with the execution of the symfony command on ovh.

  • I created a command and sh script :
#!/bin/bash 
/usr/local/php7.4/bin/php -d display_errors=on ${HOME}/bin/console alertconn
  • I defined my Cron in the OVH table "Scheduled Tasks - Cron"
  • checkconnection.sh is executable (chmod 777)

In the logs I have this result:

[2022-06-28 16:15:05] ## OVH ## START - 2022-06-28 16:15:05.021447 executing: /usr/local/php7.4/bin/php /homez.804/yourcad/www/your_card_admin/src/Command/Cron/checkconnection.sh 
[2022-06-28 16:15:05] /usr/local/php7.4/bin/php -d display_errors=on ${HOME}/bin/console alertconn
[2022-06-28 16:15:05] ## OVH ## END - 2022-06-28 16:15:05.092780 exitcode: 0

Thanks in advance for the help

In the panel you have to put directly the path of your php file (the bin/console file), i suppose it's just a string and you can add your arguments after.

OVH Cron 面板

In the logs you shown the server launch you sh file with the php executor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM