🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

toolguard-daemon-control

by @johnnylambada

Manage macOS launchd user agents to start, stop, restart, check status, and access logs of persistent background services without sudo.

Versionv0.0.1
Downloads1,208
TERMINAL
clawhub install toolguard-daemon-control

πŸ“– About This Skill


name: toolguard-daemon-control description: Manage long-running processes as macOS launchd services. Use when asked to start, stop, restart, check status of, or manage background services/daemons. Handles launchd plist creation, service lifecycle, and log access. Use this instead of background exec for any process that should persist beyond the current session.

toolguard-daemon-control

Manage any executable as a persistent macOS launchd user agent.

Overview

Services are installed as ~/Library/LaunchAgents/ai.toolguard..plist and run as user-level launch agents. They auto-restart on failure and log to ~/Library/Logs/toolguard/.

Scripts

All scripts are in scripts/ relative to this skill's directory. Run them with bash.

install.sh β€” Create and start a service

bash scripts/install.sh   [args...] [--workdir ] [--env KEY=VALUE ...]

  • service-name: Short identifier (e.g., toolguard-proxy). Used in plist filename and log paths.
  • command: Absolute path to the executable.
  • args: Arguments passed to the command.
  • --workdir : Working directory for the process (default: $HOME).
  • --env KEY=VALUE: Environment variables (repeatable).
  • Example:

    bash scripts/install.sh toolguard-proxy /usr/local/go/bin/go run ./cmd/server --config toolguard.dev.yaml --workdir ~/Documents/toolguard
    

    uninstall.sh β€” Stop and remove a service

    bash scripts/uninstall.sh 
    

    Unloads the service and removes the plist file. Logs are preserved.

    status.sh β€” Check service status

    bash scripts/status.sh [service-name]
    

    Without arguments, lists all ai.toolguard.* services. With a name, shows detailed status for that service.

    logs.sh β€” View service logs

    bash scripts/logs.sh  [--follow] [--lines ]
    

    Shows stdout and stderr logs. Default: last 50 lines.

    list.sh β€” List all managed services

    bash scripts/list.sh
    

    Lists all installed ai.toolguard.* services with their running state.

    Notes

  • Services run as the current user (no sudo required).
  • Services auto-restart on crash (KeepAlive = true).
  • To run a Go project, use the compiled binary path or wrap in a shell script β€” launchd does not support go run directly. Use go build first, then point to the binary.
  • Log directory: ~/Library/Logs/toolguard//
  • Plist location: ~/Library/LaunchAgents/ai.toolguard..plist
  • πŸ“‹ Tips & Best Practices

  • Services run as the current user (no sudo required).
  • Services auto-restart on crash (KeepAlive = true).
  • To run a Go project, use the compiled binary path or wrap in a shell script β€” launchd does not support go run directly. Use go build first, then point to the binary.
  • Log directory: ~/Library/Logs/toolguard//
  • Plist location: ~/Library/LaunchAgents/ai.toolguard..plist