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.
What this skill does
# 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 ```bash # 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 ```bash # 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 ```bash # 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 [email protected] PATH=/usr/local/bin:/usr/bin:/bin SHELL=/bin/bash 0 3 * * * /opt/scripts/backup.sh ``` ### Step 4: System Cron (root tasks) ```bash # /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.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.