cron as a Linux alternative to Task Scheduler
Updated
Our verdict
Cron is a solid replacement for Windows Task Scheduler for users who need to schedule recurring jobs based on time. It covers the core use‑cases of running scripts, binaries, and commands at specific times or intervals, and can operate without a logged‑in user. It is ideal for system administrators, developers, and power users who prefer a text‑based configuration and are comfortable with the crontab syntax. For users who rely heavily on event‑driven triggers or a graphical interface, systemd timers or third‑party tools may be preferable.
- License
- GPL-3.0
- Price
- Free
- Latest version
- 4.1
- Rating
- —
What works the same
- Both schedule tasks to run automatically at specified times or intervals
- Both can execute scripts, binaries, and system commands
- Both support running tasks without a user being logged in
- Both allow redirecting output to files or mail
- Both can be managed per user
What is different
- Cron is purely time‑based; it does not natively trigger on arbitrary system events (e.g., network connection, USB insertion)
- Cron lacks a built‑in graphical UI; configuration is via plain text files
- Cron does not provide a detailed execution log or status view out of the box; logs are written to syslog or mailed
- Cron cannot run tasks based on complex conditions or dependencies between jobs
- Cron does not support running tasks with elevated privileges unless the user’s crontab is edited by root
Opening your Task Scheduler files
Windows Task Scheduler stores jobs in .job files that are not readable by cron. There is no direct import or export mechanism. To migrate, you must manually translate each scheduled task into a crontab entry, recreating any required environment variables or command wrappers.
Switching from Task Scheduler to cron, step by step
- 1. Export the Task Scheduler list to a readable format (e.g., use the Task Scheduler console to view each task’s trigger and action).
- 2. For each task, decide the equivalent cron schedule (minute, hour, day, month, weekday).
- 3. Open the user’s crontab with
crontab -eand add a line using the syntax* * * * * commandor an @directive. - 4. If the task requires environment variables, prepend them in the crontab line or source a wrapper script.
- 5. Redirect output to a file or mail by appending
>> /var/log/cron_task.log 2>&1or| mail -s "Cron output" user@example.com. - 6. Test the new cron entry by running the command manually and checking the log or mail output.
Key features of cron
- Text‑based crontab syntax
- Supports minute, hour, day, month, weekday scheduling
- Runs under any user’s crontab
- Can redirect output to files or mail
- Handles environment variables
- Supports @reboot, @yearly, @monthly, @weekly, @daily, @hourly
How to install cron on Linux
sudo apt install cronsudo apt install cronFrequently asked questions
Can cron run a task only once at a specific time?
Yes, use the at command for one‑off jobs, or schedule a cron job that deletes itself after running.
How do I keep a cron job from running if the machine is off?
Cron only runs when the system is up. To run a job after boot, use the @reboot directive, or rely on systemd timers for more complex conditions.
Can I schedule a cron job to run on a specific user’s login?
No, cron does not trigger on login events. Use pam_motd scripts, ~/.bash_profile, or systemd user timers for login‑based triggers.