Saltar al contenido principal
Soporte
0
Contacta con nosotros
English
Nederlands
Deutsch
Servidores dedicadosFlexible VPSTecnología de nubeUbicación compartidaDesafíos en TISectoresCareers
Cloud Compute

Con Cloud Compute, tendrás acceso a un portal desde el que podrás configurar todo tu entorno informático en cualquier momento y desde cualquier lugar del mundo.

Almacenamiento en la nube

Acceso fiable a tus archivos, infraestructura y aplicaciones en todo momento, sin interrupciones ni retrasos. En Worldstream, ofrecemos una gran variedad de soluciones de almacenamiento.

Flexible cloud icon
Nube flexible
Private cloud icon
Nube privada
Bare metal icon
Bare Metal Compute
Hollow cube icon
Almacenamiento de objetos
Hollow cube icon
Almacenamiento de archivos
Block storage icon
Almacenamiento en bloque
Backup storage icon
Almacenamiento de copias de seguridad
¿Necesitas soporte?

Con ingenieros experimentados y un tiempo medio de respuesta de 7 minutos, puedes esperar una solución de soporte técnico sólida muy rápida.

Soporte
Todos los servidores

Elige tu servidor dedicado ahora. Configuración personalizada o entrega inmediata. Servidores potentes diseñados para tu caso de uso.

Casos de uso

Sea cual sea tu caso de uso, te ayudamos a encontrar la solución adecuada.

Deal servers icon
Ofertas
AMD servers icon
Servidores AMD
AI servers icon
Servidores Intel
Hollow cube icon
Virtualización, Contenerización y Orquestación
Hollow cube icon
Sitios web y aplicaciones
Hollow cube icon
Infraestructura para gaming y streaming

Soporte 24/7/365 con un tiempo medio de respuesta de solo 7 minutos. Gracias a nuestros propios centros de datos, nuestros ingenieros pueden acceder directamente a tu servidor para ofrecer soporte rápido y directo. Contáctanos por correo o teléfono en cualquier momento.

Soporte
Externalización inteligente

Algunos aspectos de la TI crean valor añadido, mientras que otros sirven de apoyo. Aprovéchalo como punto de partida para la externalización.

Rentabilidad

Los paquetes informáticos completos pueden parecer la opción segura, pero al considerar los costes, otras opciones suelen tener más sentido.

Flexibilidad y control informáticos

Externalizar no implica perder el control; en realidad proporciona más flexibilidad y control.

Repatriación desde la nube

La nube no es el destino final: debes evaluar y ajustar tu entorno de nube continuamente a medida que cambian las necesidades.

Servicios financieros
Logística y transporte
Venta minorista y comercio electrónico
Medios de comunicación y entretenimiento
Tecnología y desarrollo de software
Seguridad
Proveedores de servicios gestionados
¿Necesitas soporte?

Con ingenieros experimentados y un tiempo medio de respuesta de 7 minutos, puedes esperar una solución de soporte técnico sólida muy rápida.

Habla con nosotrosContacta con nosotros
Acerca de WorldstreamAcerca de la tecnologíaCasosBase de conocimientos
Quiénes somosConoce al equipoTrabaja con nosotrosHazte distribuidorcertificacionesNuestros centros de datosNuestra redProtección DDoSServidores AMD EPYCPartners tecnológicosAcerca de los servidores dedicadosTodos los casosEasyTerraDutch Drone CompanyPerfGridArtículosPreguntas frecuentesNoticias y blogsProductos y servicios
Contacta con nosotros

Llama al +31 (0) 174 – 712 117 Industriestraat 53, Naaldwijk

Contacta con nosotros
Worldstream Portal
English
Nederlands
Deutsch
0
Servidores dedicadosFlexible VPSTecnología de nubeUbicación compartidaDesafíos en TISectoresCareersAcerca de WorldstreamAcerca de la tecnologíaCasosBase de conocimientosMy Worldstream
Contact
Soporte
EnglishNederlandsDeutsch
  1. InicioInicio
  2. Base de conocimientos
  3. Dedicated Servers
  4. Cron jobs: scheduling recurring tasks on a Linux server

Cron jobs: scheduling recurring tasks on a Linux server

Se aplica a Linux servers, VPS and dedicatedAudiencia Sysadmin, developerÚltima revisión September 2026

Respuesta rápida

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.

En esta página
  • 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
¿Te ha resultado útil este artículo?

Informática sólida. Sin sorpresas

Tu socio para la madurez informática
Eliminamos barreras para que puedas correr
Costes previsibles y transparentes

Contacto

  • Industriestraat 53, Naaldwijk
Contacta con nosotros
Worldstream Portal (opens in a new tab)
  • Métodos de pago
  • Abuso
  • Recursos para desarrolladores
  • Centro de operaciones de red
  • Quiénes somos
  • Conoce al equipo
  • Trabaja con nosotros
  • Hazte distribuidor
  • certificaciones
  • Nuestros centros de datos
  • Nuestra red
  • Protección DDoS
  • Servidores AMD EPYC
  • Partners tecnológicos
  • Sistemas operativos
  • Vista general
  • Preguntas frecuentes
  • Casos
  • Noticias y blogs
  • Use Cases
English
Nederlands
Deutsch
English
Nederlands
Deutsch
  • Legal
  • Notificación de vulnerabilidades