Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey Mike!

    Once you set up your server side cron, our plugin doesn’t detect it per say, and simply show this message permanently.

    You should especially not delete this file!

    As long as your emails are sending on time, that’s what’s important.

    Thread Starter mikecd

    (@mikecd)

    This isn’t resolved. The problem is it creates a new file every time the cron job runs. Leave it for a few days and you have thousands of these files on your server. It’s actually pretty ridiculous. I created a second cron job to run and delete these files. I can’t just let thousands of files accumulate there like that. It gets in the way of the important files there.

    Wow, that’s not the expected behavior at all. :s

    Please get in touch via our contact form: http://support.mailpoet.com/feedback/

    One of our team members will help you sort it out!

    Hi Mike,

    Just use following options to wget in cron-job to avoid creating files:
    wget -q -O – http://url

    Hi!

    Marco from MailPoet here.

    I’d like to clarify how the MailPoet cron URL works, and explain a little bit more on why you are seeing those files in your folder.

    On UNIX systems, having output from a cron job is an expected and required behaviour, for the purpose of debugging issues and reporting to system administrators. So, after the execution of a cron job is completed, two things happen on a standard Linux server:
    – The output of the script is sent to the standard output, and logged.
    – An email will be sent to the administrator, in case of error exit codes.

    In this specific case, since the cron job has been set up with wget, a file is being downloaded too. That’s because wget is a download utility, and its normal behavior is not to just visit an url, but download the page.

    Now, let’s see how we can avoid these three events from happening, and have a real silent cron 🙂

    This is your current cron job:
    $ wget “http://mailpoet.com/cron”

    Here’s what it’s doing:
    1. Download that page to a file named cron.
    2. Output the wget standard output to the console and to a log file.
    3. Send an email to the admin in case wget can’t download that page.

    Here’s how to stop it:

    1. Stop downloading the file.
    Curl is the proper utility to visit an URL without downloading anything, instead of wget. So, let’s replace wget with:
    $ curl –silent “http://mailpoet.com/cron”

    2. Stop outputting to the console.
    Let’s redirect the command to null:
    $ curl –silent “http://mailpoet.com/cron” > /dev/null

    3. Stop sending emails in case of errors.
    If the curl call exits with an error status code, even if we are redirecting the output to null, we’ll get an email. We need to tell the cron job that we want to consider error exit codes (2) as normal exit codes and send them to null too, so we add this at the end:
    $ curl –silent “http://mailpoet.com/cron” > /dev/null 2>&1

    This is a truly silent cron job. 🙂

    Thread Starter mikecd

    (@mikecd)

    Thanks so much Marco! It works perfectly.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Cron Job’ is closed to new replies.