0

Our cron script stopped working in different dates in August. What can be the possible reasons? We did not change anything. Our hosting showed us a log where we can see that cron is executing our scripts. But, nothing is happening in our scripts.

If we manually execute the scripts, we're getting correct results like before.

I showed the commands to hosting and they showed me that the commands are working. What should I tell my hosting? what should I do?

They are php scripts which are executed by CRON and they just post to facebook and twitter. They don't execute any hard or huge things. I even asked my hosting if we broke any rules.

Eric Leschinski
  • 4,211
  • 4
  • 21
  • 27
Robi
  • 131
  • 1
  • 6
  • This may not be a great question for this forum. Without knowing what your scripts are, and as the various things that could go wrong with them (i.e. loss of database connectivity, running out of disk space, etc.) there really isn't much anyone can do to help. – Mike Brant Sep 07 '12 at 18:04
  • Try turning on display errors for the cron-scripts, and make sure the emails from cron go where you can read the output, if any. – rrehbein Sep 07 '12 at 18:06
  • What does your script look like? – quanta Sep 07 '12 at 18:08
  • Also please check the /var/log/cron file. – sandeep.s85 Sep 07 '12 at 18:09

1 Answers1

1

My PHP code had

require $_SERVER'DOCUMENT_ROOT']."/myfile.php";

it was not working from shell cron.

I changed it following code.

require "mydir/myfile.php"

It started working. Basically, $_SERVER'DOCUMENT_ROOT'] was not working with require for shell execution. Please notice that the script was working with the both two codes for direct URL access from browsers. But first code is not working only for CRON.

Robi
  • 131
  • 1
  • 6
  • As the PHP script is not being executed by a web server you can't use web server super globals such as $SERVER. You've also left out the opening square bracket, so that code would fail with a syntax error anyway. – John Gardeniers Sep 11 '12 at 03:31