Back to DevOps Series

Cron Jobs in WSL/Linux :

1. What is Cron?

  • Cron = scheduler for automatically running commands/scripts at a specific time.
  • Crontab = file where cron jobs are defined.

2. Check Cron Service

Loading...
Start:
Loading...
Stop:
Loading...
Restart:
Loading...

3. Open Crontab

Edit your user's cron jobs:
Loading...
View cron jobs:
Loading...
Remove all cron jobs:
Loading...

4. Cron Syntax

Loading...
Format: minute hour day-of-month month day-of-week command

5. Examples

Run every minute:
Loading...
Run every day at 10:30 AM:
Loading...
Run every Sunday at 9 AM:
Loading...
Run every 5 minutes:
Loading...
Run every hour:
Loading...

6. Run a Script with Cron

Make script executable:
Loading...
Add to crontab:
Loading...
Use absolute paths in cron jobs.

7. Redirect Output to a File

Loading...
  • >> → append output
  • 2>&1 → redirect errors to the same file

8. Special Cron Shortcuts

Loading...
Example:
Loading...

Key Commands

Loading...