Why is my cronjob won’t work?

Why is my cronjob won’t work?

The basic problem with cron when run manually but not when run in cron job is the “working directory” when it is run.  The “working directory” is where the script is run from it is very different depend on how it is run. 

Your cron script need to be smart enough to detect which working directory it start from and adjust accordingly.

Please make sure you code accordingly in your cron job adapt for different situation.

Even if you don’t use drupal but you should review how Drupal cron.php is done in Drupal since it is working for manual run or in cron job run.

Please compare what you do in your cron and what is being done in Drupal and learn how it is done correctly.

Discussions