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 “https://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 “https://mailpoet.com/cron”
2. Stop outputting to the console.
Let’s redirect the command to null:
$ curl –silent “https://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 “https://mailpoet.com/cron” > /dev/null 2>&1
This is a truly silent cron job. ??