Skip to content
OpenSmartRoute
Skillv1.0.0

cron

Schedule recurring tasks with cron on Linux/macOS. Use when a user asks to run scripts on a schedule, set up automated backups, schedule data processing, or configure periodic tasks on a server.

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/cron/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill cron. Copyright stays with the author (Apache-2.0).

cron

Overview

cron is the standard Unix task scheduler. Define schedules with cron expressions (minute, hour, day, month, weekday) to run scripts automatically. Used for backups, log rotation, data sync, health checks, and any recurring task.

Instructions

Step 1: Crontab Basics

# Edit your crontab
crontab -e

# Format: minute hour day month weekday command
# ┌─── minute (0-59)
# │ ┌─── hour (0-23)
# │ │ ┌─── day of month (1-31)
# │ │ │ ┌─── month (1-12)
# │ │ │ │ ┌─── day of week (0-7, 0=Sun)
# │ │ │ │ │
# * * * * * command

Step 2: Common Schedules

# Every day at 3 AM
0 3 * * * /opt/scripts/backup.sh

# Every hour
0 * * * * /opt/scripts/health-check.sh

# Every 15 minutes
*/15 * * * * /opt/scripts/sync-data.sh

# Monday to Friday at 9 AM
0 9 * * 1-5 /opt/scripts/daily-report.sh

# First day of every month at midnight
0 0 1 * * /opt/scripts/monthly-cleanup.sh

# Every Sunday at 2 AM
0 2 * * 0 /opt/scripts/weekly-maintenance.sh

Step 3: Best Practices

# Always redirect output to a log file
0 3 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1

# Use full paths (cron has minimal PATH)
0 * * * * /usr/bin/node /opt/app/scripts/job.js

# Set environment variables
MAILTO=admin@example.com
PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/bash

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

Step 4: System Cron (root tasks)

# /etc/cron.d/app-maintenance — System-level cron file
SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin

# Database backup as postgres user
0 3 * * * postgres pg_dump myapp > /backups/myapp-$(date +\%Y\%m\%d).sql

# Log rotation
0 0 * * * root /usr/sbin/logrotate /etc/logrotate.conf

Guidelines

  • Always use full paths in cron — the PATH is minimal.
  • Redirect output to log files or /dev/null — unhandled output gets emailed.
  • Use crontab -l to list, crontab -e to edit, crontab -r to remove all (careful!).
  • For modern alternative with dependency tracking, use systemd timers.
  • Test commands manually before putting them in cron.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-cron/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-cron.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-cron",
  "kind": "skill",
  "name": "cron",
  "description": "Schedule recurring tasks with cron on Linux/macOS. Use when a user asks to run scripts on a schedule, set up automated backups, schedule data processing, or configure periodic tasks on a server.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "cron",
      "scheduling",
      "automation",
      "linux",
      "tasks",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Schedule recurring tasks with cron on Linux/macOS. Use when a user asks to run scripts on a schedule, set up automated backups, schedule data processing, or configure periodic tasks on a server."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/cron/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/cron/SKILL.md",
      "key": "terminalskills/skills/skills/cron/SKILL.md"
    },
    "compatibility": "Linux, macOS",
    "license": "Apache-2.0"
  },
  "instructions": "# cron\n\n## Overview\n\ncron is the standard Unix task scheduler. Define schedules with cron expressions (minute, hour, day, month, weekday) to run scripts automatically. Used for backups, log rotation, data sync, health checks, and any recurring task.\n\n## Instructions\n\n### Step 1: Crontab Basics\n\n```bash\n# Edit your crontab\ncrontab -e\n\n# Format: minute hour day month weekday command\n# ┌─── minute (0-59)\n# │ ┌─── hour (0-23)\n# │ │ ┌─── day of month (1-31)\n# │ │ │ ┌─── month (1-12)\n# │ │ │ │ ┌─── day of week (0-7, 0=Sun)\n# │ │ │ │ │\n# * * * * * command\n```\n\n### Step 2: Common Schedules\n\n```bash\n# ",
  "cost": {
    "context_tokens": 513
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-cron/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.