How to Create a Cron Job: A Fast 5-Step Tutorial
September 10, 2026


Most developers who search for how to create a cron job just want a working scheduled task, fast. This tutorial gets you there in five steps, then covers what to do if you're not on a Linux shell, and how to tell whether the job you just created is actually running successfully once it's live.
What You Need Before You Create a Cron Job
Before you touch a crontab, confirm three things:
- Shell or SSH access, or a hosting control panel with a cron UI if you're on shared hosting.
- The exact path to the command or script you want to run — cron doesn't use your shell's interactive PATH, so
myscript.shwon't work but/home/user/scripts/myscript.shwill. - A clear schedule in mind — how often, and at what time, the job should fire.
These are the real cron job prerequisites. Crontab access alone isn't enough if you don't know the absolute path to your script — that single detail causes more failed first attempts than anything else.
How to Create a Cron Job in 5 Steps
This is the core workflow for how to create a cron job on Linux (and it works identically on macOS, since both use the same cron daemon and crontab tool).
Step 1: Open Your Crontab
Run:
crontab -e
This opens your personal crontab for editing. The first time you run it, you may be prompted to choose an editor — nano is friendlier for beginners, vim is faster once you know the keybindings. Pick nano if you're unsure; you can change the default later with select-editor.
Step 2: Understand the Schedule Format (Quick Refresher)
Every cron job syntax line has five time fields followed by the command:
minute hour day-of-month month day-of-week command
So 0 6 * * * means "run at 6:00 AM every day," and */15 * * * * means "every 15 minutes." An asterisk means "any value" for that field. That's enough to write most jobs — for the full breakdown of ranges, steps, and lists in each field, see Cron Job Command: Syntax, Crontab Flags & Silent Failures.
Step 3: Write the Cron Line
Combine your schedule with the full path to your script or command. A real example:
0 2 * * * /home/user/scripts/backup.sh >> /home/user/logs/backup.log 2>&1
This runs backup.sh at 2:00 AM every day and redirects both standard output and errors to a log file — a habit worth building into every new job. For ready-to-use schedules instead of building one from scratch, 15 Cron Job Examples You Can Copy and Paste Today covers the most common patterns. If the script itself isn't written yet, Cron Job Script: How to Write One That Runs Correctly walks through getting that part right first.
Step 4: Save and Exit
In nano: press Ctrl+O to write the file, Enter to confirm the filename, then Ctrl+X to exit.
In vim: press Esc, then type :wq and hit Enter.
Either way, you should see a message like crontab: installing new crontab — confirmation the file was written, not just edited in memory.
Step 5: Verify the Job Was Added
Don't assume it saved — check:
crontab -l
This lists every job in your current crontab. If your new line appears exactly as you wrote it, you're done. If it's missing, you likely exited without saving, or edited the wrong user's crontab (root's crontab is separate from a regular user's — more on that below).
Creating Cron Jobs Outside the Terminal
Not every environment gives you a shell. On shared hosting, most control panels have a Cron Jobs section — you pick the schedule from dropdowns and paste in the command, no crontab editing required. This is the standard way to create a cron job in cPanel and functionally identical to writing a crontab line under the hood.
On Windows, there's no crontab at all — Windows Task Scheduler is the cron equivalent, letting you define triggers (daily, weekly, at logon) and actions (run a script or executable) through a GUI or schtasks on the command line.
If your workload lives in the cloud, cron-style scheduling shows up there too: AWS EventBridge (formerly CloudWatch Events) can trigger Lambda functions or other targets on a cron expression, and GitHub Actions supports scheduled workflows using the same five-field cron syntax directly in a YAML file. For a side-by-side comparison of terminal editing versus GUI and online options, see Cron Job Editor: Terminal, GUI, and Online Tools Compared.
Common Mistakes That Break a Newly Created Cron Job
A cron job that doesn't run almost always fails for one of these reasons:
- Wrong or missing PATH. Cron runs with a minimal environment, so commands that work in your interactive shell (like
pythonornode) may not resolve. Use full paths (/usr/bin/python3) to be safe. - Missing execute permissions. If your script isn't marked executable (
chmod +x script.sh), cron will fail to run it. - No output redirection. Without
>> logfile 2>&1, errors vanish silently — you'll have no record of what went wrong. - Typos in the schedule fields. A misplaced asterisk or wrong field order can create a job that runs at the wrong time, or almost never, with no error thrown.
This is exactly why cron job not running issues are so hard to diagnose — cron itself doesn't tell you when something's wrong. It just doesn't run, or runs and fails, and stays quiet either way.
How to Confirm Your New Cron Job Is Actually Running
Here's the gap most tutorials skip: crontab -l confirms the job was saved, not that it ran, and it certainly doesn't confirm the run succeeded. A script can execute on schedule and still exit with an error, hang, or produce no output at all — and cron will never alert you.
The reliable way to close that gap is a health check: your script pings a monitoring URL at the end of a successful run. If the ping doesn't arrive on schedule, you get notified — instead of finding out days later that a backup job silently stopped working.
Creating and saving a cron job is the easy part. Confirming it keeps running correctly, every time, is the part cron was never built to handle — it doesn't alert on failures, timeouts, or missed runs. Once your job is live, add a Cronevra health check URL to the end of the command so you're notified the moment a run fails or doesn't fire at all, instead of finding out the hard way.
Frequently Asked Questions
How do I create a cron job on Linux?
Run crontab -e to open your personal crontab in your default editor, add a line in the format minute hour day month weekday command, then save and exit. Confirm it was added with crontab -l, which lists every job currently scheduled for your user.
Do I need root access to create a cron job?
No — any user with crontab access can create their own cron jobs with crontab -e, which edits that user's personal crontab. Root access is only needed for system-wide cron jobs placed in /etc/crontab or /etc/cron.d/, or to edit another user's crontab.
How can I create a cron job on a Mac?
macOS uses the same cron daemon as Linux, so crontab -e works identically on both. Open Terminal, run crontab -e, add your schedule line, save, and verify with crontab -l — no separate tool is needed.
Can I create a cron job without using the terminal?
Yes. Shared hosting control panels like cPanel offer a Cron Jobs section with a graphical schedule builder, Windows uses Task Scheduler as its cron equivalent, and cloud platforms like AWS EventBridge and GitHub Actions support cron-style scheduling through their own interfaces or config files.
Why isn't my newly created cron job running?
The most common causes are an incorrect PATH (cron uses a minimal environment, unlike your interactive shell), missing execute permissions on the script, or a typo in the five schedule fields. Since cron fails silently, check your crontab syntax with crontab -l and add output redirection to a log file to see actual errors.
How do I create a cron job that runs every day at a specific time?
Set the minute and hour fields to your target time and leave the rest as asterisks — for example, 30 9 * * * runs a job every day at 9:30 AM. Add your full script path after the schedule, save the crontab, then confirm with crontab -l.