_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Cron a Systemd Timers

02. 04. 2023 1 min read intermediate

Cron je tradiční, systemd timery moderní alternativa s lepší integrací.

Cron

crontab -e

m h dom mon dow command

0 2 * * * /opt/backup.sh */5 * * * * /opt/check.sh 0 2 * * * /opt/backup.sh >> /var/log/backup.log 2>&1 * * * * * flock -n /tmp/task.lock /opt/task.sh

Systemd Timers

backup.timer

[Timer] OnCalendar=*-*-* 02:00:00 Persistent=true [Install] WantedBy=timers.target

backup.service

[Service] Type=oneshot ExecStart=/opt/backup.sh systemctl enable –now backup.timer systemctl list-timers

Comparison

  • Logy: cron → syslog, timer → journalctl
  • Závislosti: timer → After=, Requires=
  • Resource limity: timer → přes service
  • Persistent: timer doběhne zmeškané

Timery pro nové projekty

Pro nové projekty systemd timery. Cron pro jednoduché legacy úlohy.

cronsystemdtimers
Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.