Skip to content
NeuralSkills
Productivity

Cron Job Designer

Design and manage scheduled automation with correct cron expressions and monitoring.

Intermediate Free Published: April 15, 2026
Compatible Tools claude-codechatgptgeminicopilotcursorwindsurfuniversal

The Problem

Cron syntax is cryptic, error-prone, and hard to debug. Developers misconfigure schedules, forget about timezone issues, miss overlapping executions, and lack monitoring for when jobs silently fail. A cron job that runs at the wrong time or fails without alerting anyone can cause data loss, stale caches, or missed backups.

The Prompt

You are a systems reliability engineer specializing in scheduled automation. Design a cron-based automation setup for my task.

TASK DETAILS:
- What to run: [command, script, or process]
- Schedule: [describe in plain language — "every weekday at 3am", "every 15 minutes during business hours"]
- Timezone: [your timezone]
- Dependencies: [what must be true before the job runs — DB available, disk space, etc.]
- Failure impact: [what happens if the job fails or runs twice]

DESIGN REQUIREMENTS:
1. Generate the exact cron expression with a human-readable comment
2. Wrap the command in a shell script with logging, error handling, and lock files
3. Add monitoring — log output, exit code checking, and failure notifications
4. Prevent overlapping runs with flock or PID files
5. Include a test command to verify the schedule without executing
6. Document how to install, verify, and uninstall the cron job

Output the complete cron entry and wrapper script.

Example Output

# Crontab entry — runs database backup every day at 2:30 AM UTC
# Minute Hour Day Month Weekday
30 2 * * * /opt/scripts/backup-db.sh >> /var/log/backup-db.log 2>&1

# --- /opt/scripts/backup-db.sh ---
#!/bin/bash
set -euo pipefail

LOCK_FILE="/tmp/backup-db.lock"
LOG_PREFIX="[$(date '+%Y-%m-%d %H:%M:%S')]"

# Prevent overlapping runs
exec 200>"$LOCK_FILE"
flock -n 200 || { echo "$LOG_PREFIX Another backup is running. Exiting."; exit 0; }

echo "$LOG_PREFIX Starting database backup..."
pg_dump mydb | gzip > "/backups/mydb-$(date +%Y%m%d).sql.gz"

# Verify backup file exists and is not empty
BACKUP_FILE="/backups/mydb-$(date +%Y%m%d).sql.gz"
if [ ! -s "$BACKUP_FILE" ]; then
  echo "$LOG_PREFIX ERROR: Backup file is empty or missing"
  curl -s -X POST "$SLACK_WEBHOOK" -d '{"text":"DB backup FAILED"}'
  exit 1
fi

echo "$LOG_PREFIX Backup complete: $BACKUP_FILE ($(du -h "$BACKUP_FILE" | cut -f1))"

When to Use

Use this skill when setting up any scheduled task — backups, cache clearing, report generation, data syncing, certificate renewal, log rotation, or health checks. Always use it instead of writing cron entries from memory.

Pro Tips

  • Always use flock — overlapping runs are the most common cron bug and can corrupt data.
  • Log everything with timestamps — when a cron job fails at 3 AM, logs are your only debugging tool.
  • Test with a 1-minute schedule first — verify it works before setting the real interval.