> 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.
curl "https://skillshub.wtf/TerminalSkills/skills/cron?format=md"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 -lto list,crontab -eto edit,crontab -rto remove all (careful!). - For modern alternative with dependency tracking, use systemd timers.
- Test commands manually before putting them in cron.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.