據 AlphaMoat 統計,截至 2026-10,Cron & Scheduling 累計下載 14,487 次、獲 9 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 1,928 位,在「運維安全」分類(502 個)中排名第 63 位。
列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。
| 平台 | 累計下載 | 星標 | 評論 |
|---|---|---|---|
| ClawHub ↗ | 1.1萬 | 9 | - |
| SkillHub ↗ | 1.4萬 | 9 | — |
各平台的計數口徑不同,統計時間不一致。
涵蓋 cron 語法、crontab 管理、systemd timer、at、時區、日誌、故障診斷、重疊鎖和冪等性。應在目標系統核驗時間表達式與環境行為,加固 shell 示例、權限和輸出路徑。先在非生產環境測試;破壞性或提權操作需操作者顯式批准。
資料釋出於 2026-10-27
以下是根據技能文件生成的示例,不代表實際執行結果。
2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。
| 月份 | 累計下載 | 環比 | 星標 |
|---|---|---|---|
| 2026-10 | 1.4萬 | — | 9 |
| 2026-09 | 1.1萬 | — | 9 |
| 2026-08 | 1.1萬 | +2.9% | 9 |
| 2026-07 | 1萬 | +5.2% | 9 |
| 2026-06 | 9756 | +3.0% | 8 |
| 2026-05 | 9475 | — | 7 |
以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。
---
name: cron-scheduling
description: Schedule and manage recurring tasks with cron and systemd timers. Use when setting up cron jobs, writing systemd timer units, handling timezone-aware scheduling, monitoring failed jobs, implementing retry patterns, or debugging why a scheduled task didn't run.
metadata: {"clawdbot":{"emoji":"⏰","requires":{"anyBins":["crontab","systemctl","at"]},"os":["linux","darwin"]}}
---
# Cron & Scheduling
Schedule and manage recurring tasks. Covers cron syntax, crontab management, systemd timers, one-off scheduling, timezone handling, monitoring, and common failure patterns.
## When to Use - Running scripts on a schedule (backups, reports, cleanup) - Setting up systemd timers (modern cron alternative) - Debugging why a scheduled job didn't run - Handling timezones in scheduled tasks - Monitoring and alerting on job failures - Running one-off delayed commands ## Cron Syntax ### The five fields ``` ┌───────── minute (0-59) │ ┌─────── hour (0-23) │ │ ┌───── day of month (1-31) │ │ │ ┌─── month (1-12 or JAN-DEC) │ │ │ │ ┌─ day of week (0-7, 0 and 7 = Sunday, or SUN-SAT) │ │ │ │ │ * * * * * command ``` ### Common schedules ```bash # Every minute * * * * * /path/to/script.sh # Every 5 minutes */5 * * * * /path/to/script.sh # Every hour at :00 0 * * * * /path/to/script.sh # Every day at 2:30 AM 30 2 * * * /path/to/script.sh # Every Monday at 9:00 AM 0 9 * * 1 /path/to/script.sh # Every weekday at 8:00 AM 0 8 * * 1-5 /path/to/script.sh # First day of every month at midnight 0 0 1 * * /path/to/script.sh # Every 15 minutes during business hours (Mon-Fri 9-17) */15 9-17 * * 1-5 /path/to/script.sh # Twice a day (9 AM and 5 PM) 0 9,17 * * * /path/to/script.sh # Every quarter (Jan, Apr, Jul, Oct) on the 1st at midnight 0 0 1 1,4,7,10 * /path/to/script.sh # Every Sunday at 3 AM 0 3 * * 0 /path/to/script.sh ``` ### Special strings (shorthand) ```bash @reboot /path/to/script.sh # Run once at startup @yearly /path/to/script.sh # 0 0 1 1 * @monthly /path/to/script.sh # 0 0 1 * * @weekly /path/to/script.sh # 0 0 * * 0 @daily /path/to/script.sh # 0 0 * * * @hourly /path/to/script.sh # 0 * * * * ``` ## Crontab Management ```bash # Edit current user's crontab crontab -e # List current crontab crontab -l # Edit another user's crontab (root) sudo crontab -u www-data -e # Remove all cron jobs (be careful!) crontab -r # Install crontab from file crontab mycrontab.txt # Backup crontab crontab -l > crontab-backup-$(date +%Y%m%d).txt ``` ### Crontab best practices ```bash # Set PATH explicitly (cron has minimal PATH) PATH=/usr/local/bin:/usr/bin:/bin # Set MAILTO for error notifications [email protected] # Set shell explicitly SHELL=/bin/bash # Full crontab example PATH=/usr/local/bin:/usr/bin:/bin [email protected] SHELL=/bin/bash # Backups 0 2 * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1 # Cleanup old logs 0 3 * * 0 find /var/log/myapp -name "*.log" -mtime +30 -delete # Health check */5 * * * * /opt/scripts/healthcheck.sh || /opt/scripts/alert.sh "Health check failed" ``` ## Systemd Timers ### Create a timer (modern cron replacement) ```ini # /etc/systemd/system/backup.service [Unit] Description=Daily backup [Service] Type=oneshot ExecStart=/opt/scripts/backup.sh User=backup StandardOutput=journal StandardError=journal ``` ```ini # /etc/systemd/system/backup.timer [Unit] Description=Run backup daily at 2 AM [Timer] OnCalendar=*-*-* 02:00:00 Persistent=true RandomizedDelaySec=300 [Install] WantedBy=timers.target ``` ```bash # Enable and start the timer sudo systemctl daemon-reload sudo systemctl enable --now backup.timer # Check timer status systemctl list-timers systemctl list-timers --all # Check last run systemctl status backup.service journalctl -u backup.service --since today # Run manually (for testing) sudo systemctl start backup.service # Disable timer sudo systemctl disable --now backup.timer ``` ### OnCalendar syntax ```ini # Systemd calendar expressions # Daily at midnight OnCalendar=daily # or: OnCalendar=*-*-* 00:00:00 # Every Monday at 9 AM OnCalendar=Mon *-*-* 09:00:00 # Every 15 minutes OnCalendar=*:0/15 # Weekdays at 8 AM OnCalendar=Mon..Fri *-*-* 08:00:00 # First of every month OnCalendar=*-*-01 00:00:00 # Every 6 hours OnCalendar=0/6:00:00 # Specific dates OnCalendar=2026-02-03 12:00:00 # Test calendar expressions systemd-analyze calendar "Mon *-*-* 09:00:00" systemd-analyze calendar "*:0/15" systemd-analyze calendar --iterations=5 "Mon..Fri *-*-* 08:00:00" ``` ### Advantages over cron ``` Systemd timers vs cron: + Logs in journald (journalctl -u service-name) + Persistent: catches up on missed runs after reboot + RandomizedDelaySec: prevents thundering herd + Dependencies: can depend on network, mounts, etc. + Resource limits: CPUQuota, MemoryMax, etc. + No lost-email problem (MAILTO often misconfigured) - More files to create (service + timer) - More verbose configuration ``` ## One-Off Scheduling ### at (run once at a specific time) ```bash # Schedule a command echo "/opt/scripts/deploy.sh" | at 2:00 AM tomorrow echo "reboot" | at now + 30 minutes echo "/opt/scripts/report.sh" | at 5:00 PM Friday # Interactive (type commands, Ctrl+D to finish) at 10:00 AM > /opt/scripts/task.sh > echo "Done" | mail -s "Task complete" [email protected] > <Ctrl+D> # List pending jobs atq # View job details at -c <job-number> # Remove a job atrm <job-number> ``` ### sleep-based (simplest) ```bash # Run something after a delay (sleep 3600 && /opt/scripts/task.sh) & # With nohup (survives logout) nohup bash -c "sleep 7200 && /opt/scripts/task.sh" & ``` ## Timezone Handling ```bash # Cron runs in the system timezone by default # Check system timezone timedatectl date +%Z # Set timezone for a specific cron job # Method 1: TZ variable in crontab TZ=America/New_York 0 9 * * * /opt/scripts/report.sh # Method 2: In the script itself #!/bin/bash export TZ=UTC # All date operations now use UTC # Method 3: Wrapper TZ=Europe/London date '+%Y-%m-%d %H:%M:%S' # List available timezones timedatectl list-timezones timedatectl list-timezones | grep America ``` ### DST pitfalls ``` Problem: A job scheduled for 2:30 AM may run twice or not at all during DST transitions. "Spring forward": 2:30 AM doesn't exist (clock jumps 2:00 → 3:00) "Fall back": 2:30 AM happens twice Mitigation: 1. Schedule critical jobs outside 1:00-3:00 AM 2. Use UTC for the schedule: TZ=UTC in crontab 3. Make jobs idempotent (safe to run twice) 4. Systemd timers handle DST correctly ``` ## Monitoring and Debugging ### Why didn't my cron job run? ```bash # 1. Check cron daemon is running systemctl status cron # Debian/Ubuntu systemctl status crond # CentOS/RHEL # 2. Check cron logs grep CRON /var/log/syslog # Debian/Ubuntu grep CRON /var/log/cron # CentOS/RHEL journalctl -u cron --since today # systemd # 3. Check crontab actually exists crontab -l # 4. Test the command manually (with cron's environment) env -i HOME=$HOME SHELL=/bin/sh PATH=/usr/bin:/bin /opt/scripts/backup.sh # If it fails here but works normally → PATH or env issue # 5. Check permissions ls -la /opt/scripts/backup.sh # Must be executable ls -la /var/spool/cron/ # Crontab file permissions # 6. Check for syntax errors in crontab # cron silently ignores lines with errors # 7. Check if output is being discarded # By default, cron emails output. If no MTA, output is lost. # Always redirect: >> /var/log/myjob.log 2>&1 ``` ### Job wrapper with logging and alerting ```bash #!/bin/bash # cron-wrapper.sh — Run a command with logging, timing, and error alerting # Usage: cron-wrapper.sh <job-name> <command> [args...] set -euo pipefail JOB_NAME="${1:?Usage: cron-wrapper.sh <job-name> <command> [args...]}" shift COMMAND=("$@") LOG_DIR="/var/log/cron-jobs" mkdir -p "$LOG_DIR" LOG_FILE="$LOG_DIR/$JOB_NAME.log" log() { echo "[$(date -u '+%Y-%m-%dT%H:%M:%SZ')] $*" >> "$LOG_FILE"; } log "START: ${COMMAND[*]}" START_TIME=$(date +%s) if "${COMMAND[@]}" >> "$LOG_FILE" 2>&1; then ELAPSED=$(( $(date +%s) - START_TIME )) log "SUCCESS (${ELAPSED}s)" else EXIT_CODE=$? ELAPSED=$(( $(date +%s) - START_TIME )) log "FAILED with exit code $EXIT_CODE (${ELAPSED}s)" # Alert (customize as needed) echo "Cron job '$JOB_NAME' failed with exit $EXIT_CODE" | \ mail -s "CRON FAIL: $JOB_NAME" [email protected] 2>/dev/null || true exit $EXIT_CODE fi ``` ```bash # Use in crontab: 0 2 * * * /opt/scripts/cron-wrapper.sh daily-backup /opt/scripts/backup.sh */5 * * * * /opt/scripts/cron-wrapper.sh health-check /opt/scripts/healthcheck.sh ``` ### Lock to prevent overlap ```bash # Prevent concurrent runs (job takes longer than interval) # Method 1: flock * * * * * flock -n /tmp/myjob.lock /opt/scripts/slow-job.sh # Method 2: In the script LOCKFILE="/tmp/myjob.lock" exec 200>"$LOCKFILE" flock -n 200 || { echo "Already running"; exit 0; } # ... do work ... ``` ## Idempotent Job Patterns ```bash # Idempotent backup (only creates if newer than last backup) #!/bin/bash BACKUP_DIR="/backups/$(date +%Y%m%d)" [[ -d "$BACKUP_DIR" ]] && { echo "Backup already exists"; exit 0; } mkdir -p "$BACKUP_DIR" pg_dump mydb > "$BACKUP_DIR/mydb.sql" # Idempotent cleanup (safe to run multiple times) find /tmp/uploads -mtime +7 -type f -delete 2>/dev/null || true # Idempotent sync (rsync only transfers changes) rsync -az /data/ backup-server:/backups/data/ ``` ## Tips - Always redirect output in cron jobs: `>> /var/log/job.log 2>&1`. Without this, output goes to mail (if configured) or is silently lost. - Test cron jobs by running them with `env -i` to simulate cron's minimal environment. Most failures are caused by missing `PATH` or environment variables. - Use `flock` to prevent overlapping runs when a job might take longer than its schedule interval. - Make all scheduled jobs idempotent. If a job runs twice (DST, manual trigger, crash recovery), it should produce the same result. - `systemd-analyze calendar` is invaluable for verifying timer schedules before deploying. - Never schedule critical jobs between 1:00 AM and 3:00 AM if DST applies. Use UTC schedules instead. - Log the start time, end time, and exit code of every cron job. Without this, debugging failures after the fact is guesswork. - Prefer systemd timers over cron for production services: you get journald logging, missed-run catchup (`Persistent=true`), and resource limits for free.
鍾馗.Skill——會更新漏洞庫的安全審查專家。直來直去、快刀斬亂麻,三層審查(靜態審計/行為模擬/供應鏈溯源)覆蓋12類風險,輸出結構化安全裁定(✅乾淨/⚠️可疑/🚫惡意)。Use when 使用者說"審查這個Skill"、"安全檢查"、"鍾馗看下"、"審一下"、"查一下這個skill"、安裝Skill前的安全評估、或需要審計SKILL.md的惡意載荷。
在使用技能包之前做安全掃描,並按結論決定放行或攔截的技能。
為 OpenClaw 配置 OpenRouter 免費模型與回退鏈的工具。
Parse, search, and analyze application logs across formats. Use when debugging from log files, setting up structured logging, analyzing error patterns, correlating events across services, parsing stack traces, or monitoring log output in real time.
用於安裝技能、包或外掛的安全檢查。請在執行任何 npm install、openclaw plugins install、clawhub install 或類似安裝命令之前使用。
網路安全與SRC漏洞掘金實戰技能。融合「系統學習路徑」與「SRC實戰掘金」雙模式: ①學習模式=法律→基礎→工具→靶場→攻防→就業全流程; ②實戰模式=直接指導在騰訊TSRC、阿里ASRC、百度BSRC等平台挖掘高價值漏洞變現。 當用戶提出以下問題時觸發: "我想學網路安全怎麼入門""SRC漏洞怎麼挖能賺錢""滲透測試需要學什麼" "Web安全漏洞原理是什麼""怎麼準備CTF比賽""護網面試會問什麼" "雲安全怎麼學""挖漏洞賺錢的方法""埠掃描指令碼怎麼寫" "SQL隱碼攻擊怎麼檢測""子域名怎麼列舉""XSS漏洞怎麼找" "靶場怎麼搭建""Kali Linux怎麼用""Metasploit怎麼入門" "等保測評是什麼""程式碼審計怎麼做""內網滲透怎麼學" "資訊洩露漏洞怎麼挖""越權漏洞怎麼測試""邏輯漏洞挖掘技巧" "簡歷怎麼寫才能進安全公司""安全行業面試題有哪些" "Burp Suite怎麼用""DVWA怎麼安裝""Pikachu靶場搭建" "Vulhub漏洞復現""網路安全法有什麼規定""CTF奪旗賽怎麼參加" "AWD比賽是什麼""應急響應怎麼做""攻擊溯源怎麼搞" "資料安全怎麼保障""公有云安全怎麼防護""私有云攻防怎麼做" "雲原生安全是什麼"。
這個技能特別簡單——你只需要呼叫它,給一個網站域名,它就會自動幫你跑一遍滲透測試,找出這個網站存在哪些安全漏洞。 不需要你配環境、不用你手動發包,一切自動化。測完直接出結果,告訴你哪裡有問題、怎麼修。 它的願景是:讓每個人都能成為白帽駭客——只要輸入一個域名,就能知道自己的網站安不安全。一切只為授權測試,只為發現漏洞、修復風險,讓網際網路更安全。
Security-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns.
在命令列查詢、設計、遷移與最佳化 SQL 資料庫。
git-workflows 提供歷史整理、除錯和倉庫管理的進階 Git 流程。
security-audit 提供程式碼與基礎設施安全審查的清單和命令示例。
Test Patterns 指導跨語言和框架編寫、執行測試。
在命令列裡搭、測、寫文件與排錯 HTTP 介面。
資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。