Menu
User

DropVPS Team

Writer: Cooper Reagan

How to Setup cron jobs on ubuntu 25.04

How to Setup cron jobs on ubuntu 25.04

Publication Date

09/29/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Automating tasks on your server makes system management easier and more efficient. On Ubuntu 25.04, cron is the native scheduler that lets you run commands, scripts, or maintenance jobs automatically at fixed times. Here’s how to get it running smoothly.

Update Your System

Keeping your server current helps avoid unexpected issues:

sudo apt update && sudo apt upgrade -y

Install Cron (if missing)

Most Ubuntu installations already include cron. Check if it’s installed and active:

systemctl status cron

If not installed, run:

sudo apt install cron -y

Enable and start the service:

sudo systemctl enable cron
sudo systemctl start cron

Understand Cron Job Format

Cron jobs follow this schedule pattern:

* * * * * command_to_run
- - - - -
| | | | |  
| | | | └─ Day of the week (0–7, Sunday = 0 or 7)  
| | | └─── Month (1–12)  
| | └───── Day of the month (1–31)  
| └─────── Hour (0–23)  
└───────── Minute (0–59)

Edit Your User’s Crontab

To add or change cron jobs:

crontab -e

Select your preferred text editor (nano is beginner-friendly). Add new jobs at the bottom of the file.

Common Cron Job Examples

  • Run a backup daily at midnight:

    0 0 * * * /usr/local/bin/backup.sh
  • Update and upgrade every Sunday at 3 AM:

    0 3 * * 0 apt update && apt upgrade -y
  • Clean /tmp every 6 hours:
    0 */6 * * * rm -rf /tmp/*

Manage Cron Jobs

  • List current jobs:

    crontab -l
  • Remove all jobs for your user:
    crontab -r
  • System-wide jobs live in:
    /etc/crontab
    /etc/cron.*

Debug and Monitor

If a job fails or doesn’t run:

sudo journalctl -u cron

or

grep CRON /var/log/syslog

With cron on Ubuntu 25.04, you can automate updates, backups, and custom scripts to keep your system running efficiently. For fast and stable Ubuntu servers, check out DropVPS  reliable hosting built for Linux automation and developers.

Linux VPS
U
Loading...

Related Posts