Cron Job not executing script

Username

epiz_33148039

Error Message

No error message.

Other Information

I have setup 4 test Cron jobs in total on the main page (2) and in the CPanel (2) and none of them run the PHP script on my website.

I know the script works when just visiting it with the URL and/or invoking it using JS.

Any suggestions how to resolve this?

Does the client area say the cron jobs ran successfully?

2 Likes

@Greenreader9 This is all it says for the ones in the client area:

Status Code - Message
200 - OK

What is the exact URL of the page, and how are you keeping track of when it runs?

2 Likes

@Greenreader9 I will provide some more details to help clear up what I’m trying to do. If you need some more information to help resolve this issue please let me know.

Link:
URL #1 OR URL #2

I’m trying 2 different methods in an attempt to execute the PHP script.

URL #1

<?php
removeInactiveUsers();

function removeInactiveUsers(){
     // Run task
}
?>

OR

URL #2

<?php
if (isset($_GET["action"])) {
    $actionValue = $_GET["action"];

    if($actionValue == "removeInactiveUsers") {
        removeInactiveUsers();
    }
}

function removeInactiveUsers(){
     // Run task
}
?>

I’m trying to remove some inactive user log file/s. And when the Cron job runs it doesn’t execute either method to invoke the function in the above code. But when visiting the URL in the browser also the same when using AJAX call in JS is invoked it functions and clears the log files when their old enough.

It also shows the Cron job history log in the main panel and the status is always 200 - OK. But it doesn’t show any history log in the CPanel. So I manually just check the if the inactive log file/s have been removed via FTP or using a PHP link.

Please note that this is not your username.

And please note that we have a limit of three hosting accounts per PERSON. Signing up with multiple email addresses to create more than three hosting account is not allowed, and grounds for termination of all your accounts.

If you want to host multiple websites, you can use the Addon Domain functionality to host multiple domains on a single account. And if you really need many accounts, please consider buying a reseller hosting account.


As for the issue itself, I checked it and it seems that a bypass to access the site through a security system is not working. This isn’t quite trivial to fix, but I’m going to look into this and see if it can be fixed.

And maybe figure out a way to capture response bodies to make troubleshooting issues like this easier.

3 Likes

OK, two changes have just been deployed that should help make this easier:

  • The issue that was preventing cron jobs from working before has now been fixed.
  • The cron job history now records (part of) the response body from the page it queries. That gives you the opportunity to output some diagnostic information from the script which you can then review in the cron job history.
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.