Cron Scripts for Openclaw

A scheduled background script execution extension that runs bash commands directly via an OpenClaw gateway hook with hot-reloading and zero LLM cost.

gdxbsv
v1.0.0
Jun 11, 2026
0
468
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install cron-scripts

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install cron-scripts using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Cron Scripts?

The cron-scripts extension is a highly efficient utility designed to schedule and execute standard shell scripts without involving expensive language models. In the ecosystem of Openclaw Skills, this tool serves as a high-performance workaround to execute background processes such as system cleanups, local notifications, or Git updates. It leverages the underlying Gateway architecture to load custom scripts on startup, making it perfect for tasks that do not require cognitive reasoning.

By avoiding unnecessary LLM agent turns, cron-scripts ensures zero API usage costs while maintaining a unified directory of script automation. With integrated features like automated hot-reloads within milliseconds, this system guarantees that you can quickly deploy system checks and automation steps directly inside your environment without downtime.

Cron Scripts Use Cases

  • Automating recurring system maintenance such as database backups, git pulls, and file cleanup tasks.
  • Running routine infrastructure checks, HTTP health pings, and internal daemon tracking.
  • Dispatching static notifications, alerts, or system webhooks directly to Telegram or Slack endpoints.
  • Watching specific system directories for changes and executing scripts without triggering agent steps.
  • Offloading repetitive scripting tasks to save LLM tokens and lower operational overhead.

How Cron Scripts Works

  1. Gateway Hook Activation: During initialization, the OpenClaw gateway loads the startup hook handler, initializing the cron engine.
  2. Directory Monitoring: The system automatically scans and watches the designated script directory (~/.openclaw/cron-scripts/).
  3. Frontmatter Configuration Extraction: The loader reads the first 20 lines of each executable .sh file to parse execution schedules, names, timezone configurations, and timeout limits.
  4. Scheduler Enrollment: Using the bundled Node.js croner library, the hook registers task timers inside memory, ensuring that tasks are protected from executing concurrently if a previous run is active.
  5. Hot-Reloading and Execution: The watcher tracks file system updates dynamically. Modifying or deleting a script applies the updates within 300ms without requiring a gateway reboot.

Cron Scripts Setup

1. Install the Gateway Hook

Create the target folder inside your local OpenClaw structure and copy the loader handler code into place:

mkdir -p ~/.openclaw/hooks/cron-scripts-loader
cp hooks/cron-scripts-loader/handler.ts ~/.openclaw/hooks/cron-scripts-loader/handler.ts

Restart the gateway to enable hook registration:

openclaw gateway restart

2. Prepare the Scripts Directory

Set up the workspace where your scripts will be housed:

mkdir -p ~/.openclaw/cron-scripts

3. Create a Scheduled Task

Write a basic bash script with the required metadata in the script's header. Save it inside your custom cron script directory:

#!/usr/bin/env bash
# name: ping-health
# schedule: */5 * * * *
# tz: UTC
# timeout: 60

curl -sf https://hc-ping.com/your-uuid-here || echo "Ping failed!"

Grant execution privileges to the script so the runner can trigger it:

chmod +x ~/.openclaw/cron-scripts/ping-health.sh

Cron Scripts Data Schema & Taxonomy

Script Metadata Configuration

Every cron script must configure its metadata directly inside the header using a frontmatter format within the first 20 lines of the file:

Attribute Expected Type Required Description Fallback Default
name String Yes Label for identifying the task execution in your log files N/A
schedule String Yes A classic 5-field cron configuration expression N/A
tz String No Valid IANA timezone database designation UTC
timeout Number No Hard timeout limit in seconds before SIGTERM termination 120

Logs and Tracing Format

Process details are mapped directly into the system gateway outputs. Each operation maps cleanly into standard telemetry logs:

  • Startup Status: [cron-scripts-loader][<name>] Starting run
  • STDOUT Forwarding: [cron-scripts-loader][<name>] <line-output>
  • Termination Result: [cron-scripts-loader][<name>] Finished ok (exit 0)

Cron Scripts Advanced Features

  • Sub-second Hot Reloading: Employs an intelligent directory watcher to safely add, suspend (by changing extension to .disabled), or delete tasks dynamically within ~300ms.
  • Direct API Notification Interoperability: Scripts can communicate using local loops with the gateway api announce endpoint (http://localhost:3000/api/announce) to prompt instant multi-channel push announcements.
  • Concurrency Guard: Runs with built-in execution safeguards (protect: true) ensuring overlaps are gracefully avoided during intensive long-running shell scripts.
  • Direct Node Dependency Execution: Operates directly with the croner library already bundled in the host system node_modules, removing the need for external installation requirements.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*