Skip to main content
Support
0
Contact us
Nederlands
Deutsch
Español
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareers
Cloud Compute

With Cloud Compute, you have access anytime and anywhere to a portal through which you can configure your entire IT environment from wherever you are in the world.

Cloud Storage

Reliable access to your files, infrastructure, and applications at all times – with no interruptions or delays. At Worldstream, we offer a variety of storage solutions.

Flexible cloud icon
Flexible cloud
Private cloud icon
Private cloud
Bare metal icon
Bare Metal Compute
Hollow cube icon
Object storage
Hollow cube icon
File storage
Block storage icon
Block storage
Backup storage icon
Backup storage
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

All Servers

Choose your Dedicated Server now. Custom or Instant Delivery. Powerhouse servers built for your use case.

Use Cases

Whatever your use case, we’re here to help you find the ideal solution.

Deal servers icon
Deals
AMD servers icon
AMD Processors
AI servers icon
Intel Processors
Hollow cube icon
Virtualisation, Containerisation and Orchestration
Hollow cube icon
Websites and Applications
Hollow cube icon
Gaming and Streaming Infrastructure

24/7/365 support with an average response time of just 7 minutes. Thanks to our own data centers, our engineers can go directly to your server for fast, hands-on assistance. Email or call us anytime.

Smart outsourcing

Some IT creates added value, while other types are supportive. Use that as a starting point for outsourcing.

Cost Efficiency

Complete IT packages may seem like the safe option, but when you consider the costs, other choices often make more sense.

IT flexibility & control

Outsourcing doesn’t mean losing control; it actually provides more flexibility and control.

Cloud repatriation

The cloud is not a final destination: You should continuously evaluate and adjust your cloud environment as needs evolve.

Financial services
Logistics & Transportation
Retail & E-commerce
Media & Entertainment
Tech & Software Development
Security
Managed Service Providers
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

Chat with usContact us
About WorldstreamAbout the technologyCasesKnowledge base
About usMeet the teamJobsBecome a resellerCertificationsOur data centersOur networkDDoS ProtectionAMD EPYC serversTechnology PartnersOperating SystemsAll casesEasyTerraDutch Drone CompanyPerfGridArticlesFAQNews and BlogsProducts and Services
Contact us

Call +31 (0) 174 – 712 117

Industriestraat 53, Naaldwijk

Nederlands
Deutsch
Español
0
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareersAbout WorldstreamAbout the technologyCasesKnowledge baseMy Worldstream
Contact
Support
NederlandsDeutschEspañol
  1. HomeHome
  2. Knowledge Base
  3. Dedicated Servers
  4. Cron jobs: scheduling recurring tasks on a Linux server

Cron jobs: scheduling recurring tasks on a Linux server

Applies to Linux servers, VPS and dedicatedAudience Sysadmin, developerLast reviewed September 2026

Quick answer

Cron runs commands on a schedule you define with five time fields plus the command itself. Edit your own schedule with crontab -e, or drop a file into /etc/cron.d/ for system-wide jobs. The most common failure mode isn't a bad schedule, it's a script that only works when you run it by hand, because cron gives it almost none of your normal shell environment.

On this page
  • The five fields
  • Real examples
  • Editing your crontab
  • Where cron jobs silently fail
  • Make failures visible

The five fields

A crontab line has five time fields, in this order, followed by the command to run:

FieldAllowed valuesMeaning
Minute0-59Minute of the hour
Hour0-23Hour of the day, 24-hour clock
Day of month1-31Day of the month
Month1-12Month of the year
Day of week0-7 (0 and 7 both mean Sunday)Day of the week

An asterisk (*) means "every value" for that field. A slash sets a step, so */15 in the minute field means every 15 minutes. A comma lists specific values, and a hyphen sets a range.

Real examples

These are complete, working crontab lines. The path to the script is deliberately absolute, more on why below.

# Run a backup script every day at 3:00am
0 3 * * * /opt/scripts/backup.sh

# Run a health check every 15 minutes
*/15 * * * * /opt/scripts/check.sh

# Run a report on the first day of every month at 6:00am
0 6 1 * * /opt/scripts/monthly-report.sh

Editing your crontab

1

Per-user crontab

Run crontab -e as the user whose schedule you want to change. This opens the crontab in your default editor. Jobs added here run as that user, with that user's permissions.

2

Listing and removing

Run crontab -l to print the current user's crontab without opening an editor, and crontab -r to remove it entirely. Be careful with crontab -r: it deletes the whole crontab immediately, without asking for confirmation, so take a copy first with crontab -l > crontab.bak.

3

System-wide jobs

For jobs that shouldn't belong to a single user's crontab, place a file in /etc/cron.d/. The format is almost the same, but each line needs an extra field naming the user to run the command as:

0 3 * * * root /opt/scripts/backup.sh

This is also the more discoverable option in configuration management, since the file lives under version control alongside the rest of your server setup rather than inside a per-user crontab that's easy to forget about.

Where cron jobs silently fail

A script that runs perfectly when you type it at your own terminal can still fail under cron. The reason is almost always environment, not logic.

  • Minimal environment. Cron does not run a login shell, so the shell profile files that normally set up your PATH, environment variables, and aliases never run. A script that calls python3 or node and relies on your shell's PATH to find them may simply not find them under cron.
  • Different working directory. Cron jobs typically start in the home directory of the user running them, not wherever you happened to be sitting when you tested the script manually. A script using a relative path like ./data.csv will look in the wrong place.
  • No assumptions about environment variables. Anything your script depends on, such as an API key or a config path normally exported in your shell, needs to be set explicitly inside the script or the crontab entry, not assumed to already exist.

The fix for most of this is the same: use absolute paths everywhere, for the script itself, for any files it reads or writes, and for any binaries it calls. Don't assume a variable is set just because it always is when you run the script by hand.

Make failures visible

By default, cron only emails a job's output to the local mail account, which on most servers nobody is reading. A failed job can go unnoticed for weeks unless you build in a way to see it. The simplest habit is redirecting output to a log file:

0 3 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1

The 2>&1 sends error output to the same place as standard output, so both successes and failures land in one file you can check, or feed into a monitoring check. Without this, cron failures are silent by default, the job simply doesn't run correctly and nothing tells you.

Related articles

  • Common API automation recipes
  • Monitoring
  • Dedicated Servers overview
Was this article helpful?

Solid IT. No Surprises

Sparring partner for IT maturity
Eliminating barriers so you can run
Predictable and transparant costs

Contact

  • Industriestraat 53, Naaldwijk
  • Payment Methods
  • Abuse
  • Developers Resources
  • Network Operations Center
  • About us
  • Meet the team
  • Jobs
  • Become a reseller
  • Certifications
  • Our data centers
  • Our network
  • DDoS Protection
  • AMD EPYC servers
  • Technology Partners
  • Operating Systems
  • Overview
  • FAQ
  • Cases
  • News & Blogs
  • Use Cases
Nederlands
Deutsch
Español
Nederlands
Deutsch
Español
  • Legal
  • Disclosure