Jump to content

How to setup a cron job


ckuo

Recommended Posts

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!

post-183397-0-35616300-1581436755_thumb.png

Link to comment
Share on other sites

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
Link to comment
Share on other sites

/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
Link to comment
Share on other sites

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.php

It 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!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...