• Have a cron job that works perfectly fine if I click Execute Now on the Cron Manager screen, but when it runs through the schedule, it fails.

    No code errors are logged in Error Log Monitor (plugin for logging errors), but checking things with a bit of manual logging, it looks the error is related to file reading/writing.

    i.e. the manually executed version downloads a file and reads it without without any problems, while the scheduled version fails to download and read the file.

    Does cron manager have access to reading/writing files? Or does anyone have some other hints to what might be going wrong?

    Thanks,
    Mads

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support annaszalkiewicz

    (@annaszalkiewicz)

    Hi,

    Advanced Cron Manager performs the actions that WordPress would do in normal mode, and unfortunately, it’s hard to say what could cause a problem in this case.

    Thread Starter Mads Phikamphon

    (@madsphi)

    Found the solution:

    When a job is started from the dashboard, the directory is DOMAIN/wp-admin/.

    When a job is started through the cron scheduling, the directory is only DOMAIN.

    Adding a quick chdir('wp-admin'); fixes the issue, so everything is good now.

    Plugin Support annaszalkiewicz

    (@annaszalkiewicz)

    Thanks for an update, I’m glad you found the solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cron job vs. reading/writing files’ is closed to new replies.