ckuo Posted February 11, 2020 Posted February 11, 2020 Hi tech support, could you help me check if I setup the cron job correctly? I don't receive any emails from the output of the scrip so I am wondering if it runs at all. I set a gmail email in the cron job panel and the cron job frequency set to once per day. The command filled with the following: /usr/local/bin/php /home/ckuo/public_html/div_radar/tools/updateStocks.php Thanks!
wolstech Posted February 11, 2020 Posted February 11, 2020 Your command is wrong. Try this (assuming PHP 5.6 is the desired PHP version). Note that if the script doesn't produce any output, no email will be sent. ea-php56 -q /home/ckuo/public_html/div_radar/tools/updateStocks.php 2>&1 If your script produces output but you still prefer not to receive the emails containing it: ea-php56 -q /home/ckuo/public_html/div_radar/tools/updateStocks.php >/dev/null 2>&1
Krydos Posted February 11, 2020 Posted February 11, 2020 /usr/local/bin/php /home/ckuo/public_html/div_radar/tools/updateStocks.php/usr/local/bin/php should work and on Johnny it's php 7.2 Here's the errors your script is showing: PHP Warning: fopen(../../cgi-bin/div_radar_cgi/curl_log_updateStocks.txt): failed to open stream: No such file or directory in /home/ckuo/public_html/div_radar/tools/updateStocks.php on line 15 PHP Warning: curl_setopt(): supplied argument is not a valid File-Handle resource in /home/ckuo/public_html/div_radar/tools/updateStocks.php on line 17 d1 = 2020/02/11 d7 = 2020/02/18 PHP Warning: fclose() expects parameter 1 to be resource, bool given in /home/ckuo/public_html/div_radar/tools/updateStocks.php on line 25
ckuo Posted February 14, 2020 Author Posted February 14, 2020 Hi, I've tried the new syntax. I think the cron launches but the script doesn't work for some reason. I noticed that if I run the script on the browser http://ckuo.heliohost.org/div_radar/tools/updateStocks.phpIt works perfectly, but if the cron runs it, it shows these error logs below. In both cases the script is exactly the same "updateStocks.php" [14-Feb-2020 00:00:23 UTC] PHP Warning: fopen(../../cgi-bin/div_radar_cgi/curl_log_updateStocks.txt): failed to open stream: No such file or directory in /home/ckuo/public_html/div_radar/tools/updateStocks.php on line 15 Why isn't fopen able to read the files? Thanks!
Krydos Posted February 14, 2020 Posted February 14, 2020 Instead of using a relative path ../../cgi-bin use an absolute path /home/ckuo/public_html/cgi-bin.
ckuo Posted February 15, 2020 Author Posted February 15, 2020 Hi, I changed to an absolute path and it works perfectly now. Thanks a lot!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now