Cron on Linux: Setting Up the Task Scheduler on VPS

VDS / VPS Servers · 19.04.2026
Cron on Linux: Setting Up the Task Scheduler on VPS

Cron Syntax

# min  hour  day  month  weekday  command
  0     3     *    *      *       /path/to/script.sh

Schedule Examples

ExpressionWhen
0 3 * * *Daily at 03:00
*/15 * * * *Every 15 minutes
0 0 1 * *First day of each month
@rebootOn every system reboot

Practical Examples

# Database backup every 6 hours
0 */6 * * * mysqldump -u root -pPASS mydb > /backup/db_$(date +%Y%m%d).sql

# Let's Encrypt renewal
0 3 * * * certbot renew --quiet

# Log cleanup (files older than 30 days)
0 4 * * * find /var/log/myapp -name "*.log" -mtime +30 -delete
💡 Debugging cron: Add 2>&1 >> /tmp/cron.log to capture all output. If cron is silent about errors, the issue is usually PATH or file permissions.
← Back to Knowledge Base Ask Support