Cronjob keeps writing dead.letter entries every night

Hi,
I have this cronjob running every night in order to rewrite internal link index:

- name: Setup WP Internal Linkjuicer cron
  cron:
    name: "{{ item.key }} Internal Linkjuicer cron"
    hour: "0"
    user: "{{ web_user }}"
    job: "cd {{ www_root }}/{{ item.key }}/{{ item.value.current_path | default('current') }}/web/wp && wp ilj index build"
  with_dict: "{{ wordpress_sites }}"

It keeps writing to /dead.letter file, which is getting larger and larger, until the server is full and database crashes.

entries look like this:

Success: Index built successfully. Built 17180 records in 162.77 seconds.


Success: Index built successfully. Built 17180 records in 164.07 seconds.


Success: Index built successfully. Built 17180 records in 164.69 seconds.


Success: Index built successfully. Built 17180 records in 164.1 seconds.

Any idea how I can stop this or limit the dead.letter size or just have it deleted on a regular base?

Write a cronjob that will delete the file every night? :smiley:

Or is there any command I can add to the cronjob to make it NOT write anything to dead.letter?

any advice or ideas on this are welcome!

Hi @josialoos,

I assume you’re using Trellis?

You can redirect stdout and stderr to /dev/null to discard any output. This is how WP Cron is run by Trellis.

Append > /dev/null 2>&1 to your job. This will:

  1. Redirect normal output (stdout) to the ‘black hole’ of /dev/null
  2. Redirect error output (stderr) to stdout, ending up in the ‘black hole’ too.

You’ll want to make sure you have some kind of alert or monitoring system in place so that you know if / when a job fails.

2 Likes