Software⏱️ 3 min read📅 2026-06-19

How to Fix: Error setting up Crontab

Cronjob setup error due to invalid day-of-month specification.

Quick Answer: Check the day-of-month field for valid numbers (0-30) and ensure no leading zeros.

The error 'crontab: installing new crontab /tmp/crontab.fuly8s':2: bad day-of-month' occurs when there is an invalid day of the month specified in a cron job. This error affects users who are trying to set up or edit cron jobs on their system.

This error can be frustrating because it prevents users from scheduling tasks to run at specific times, which is a crucial feature for automation and productivity. However, with this troubleshooting guide, we will walk you through the steps to identify and fix the issue.

🔍 Why This Happens

  • The primary reason for this error is that the day of the month specified in the cron job is invalid or out of range. The valid days of the month are 1-31, depending on the year.
  • Another possible cause is that the system's locale settings are not set correctly, which can affect how dates and times are interpreted.

🛠️ Step-by-Step Verified Fixes

Editing the cron job manually

  1. Step 1: Open the crontab editor using the command `crontab -e`.
  2. Step 2: Locate the line that contains the invalid day of the month. It should be in the format ` * * * /usr/bin/mysqldump --all-databases > /backups/mysql/`date '+%Y-%m-%d'`.sql`.
  3. Step 3: Change the `*` to a valid day of the month (1-31). For example, if you want the cron job to run every Sunday at 12pm, change the line to `0 12 * * 0 /usr/bin/mysqldump --all-databases > /backups/mysql/`date '+%Y-%m-%d'`.sql`.
  4. Step 4: Save and exit the crontab editor. The cron job should now be installed correctly.

Using a cron job editor with date validation

  1. Step 1: Use a cron job editor like `crontab -e -v` or `crontab -l -v` to enable date validation.
  2. Step 2: Edit the cron job as usual, but the editor will now validate the dates and times before installing the cron job.

💡 Conclusion

By following these steps, you should be able to identify and fix the 'bad day-of-month' error in your cron job. Remember to always double-check your dates and times when setting up or editing cron jobs.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions