systemd
БесплатноБез исполняемых скриптовНе проверенsystemd unit file authoring and system management skill: service units, timer units, socket activation, drop-in overrides, journalctl, and security hardening…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
systemd — Unit Files and System Management
Unit File Anatomy
systemd units live in:
/lib/systemd/system/— package-installed units (do not edit directly)/etc/systemd/system/— administrator units; override package units with same name/etc/systemd/system/<name>.service.d/— drop-in overrides (preferred)
Unit files use INI-style sections. Key sections for a service:
[Unit] — metadata, dependencies, ordering
[Service] — what to run and how to manage it
[Install] — how to enable/disable (which targets want this unit)
Production Service Unit Template
Save as /etc/systemd/system/myapp.service:
[Unit]
Description=My Application Server
Documentation=https://docs.example.com/myapp
# Ordering: start after network is up and PostgreSQL is ready
After=network-online.target postgresql.service
Wants=network-online.target
# Hard dependency: if PostgreSQL stops, this unit also stops
Requires=postgresql.service
[Service]
# --- Process type ---
# simple: ExecStart is the main process; systemd tracks it directly
# forking: process daemonises (old-style); set PIDFile=
# notify: process signals systemd via sd_notify() when ready
# oneshot: for scripts that run and exit; combine with RemainAfterExit=yes
Type=notify
# --- Identity ---
User=myapp
Group=myapp
WorkingDirectory=/opt/myapp
# --- Environment ---
# Load secrets from a file not checked into source control
EnvironmentFile=/etc/myapp/environment
# Inline env vars (for non-secret values)
Environment=NODE_ENV=production
Environment=PORT=3000
# --- Process lifecycle ---
ExecStartPre=/opt/myapp/scripts/pre-start.sh # Validation / migration
ExecStart=/usr/bin/node /opt/myapp/dist/server.js
ExecStop=/bin/kill -SIGTERM $MAINPID # Graceful shutdown signal
ExecStopPost=/opt/myapp/scripts/post-stop.sh # Cleanup after stop
ExecReload=/bin/kill -SIGHUP $MAINPID # Signal for config reload (if supported)
# --- Restart behaviour ---
Restart=on-failure # Restart if process exits non-zero or is killed
RestartSec=5s # Wait 5 seconds before restarting
StartLimitIntervalSec=60s # Window for counting start attempts
StartLimitBurst=5 # Max 5 starts in 60s; unit enters failed state after
# --- Resource limits ---
LimitNOFILE=65535 # Open file descriptors (overrides /etc/security/limits.conf)
LimitNPROC=4096 # Max subprocesses
MemoryMax=2G # OOM-kill process if it exceeds 2 GB (cgroup-based)
CPUQuota=200% # Max 2 CPU cores (200% of one core = 2 cores)
TasksMax=512 # Max number of tasks (threads + processes)
# --- Output logging ---
StandardOutput=journal # stdout → journal
StandardError=journal # stderr → journal
SyslogIdentifier=myapp # Tag in journal (default: unit name without .service)
# --- Security hardening ---
PrivateTmp=true # Mount private /tmp and /var/tmp (other services can't see them)
NoNewPrivileges=true # Prevent setuid/setgid; process can't gain more privileges
ProtectSystem=strict # /usr, /boot, /etc are read-only
ProtectHome=true # /home, /root, /run/user are inaccessible
ReadWritePaths=/var/lib/myapp /var/log/myapp # Exceptions to ProtectSystem=strict
PrivateDevices=true # No access to physical devices
ProtectKernelTunables=true # Block writes to /proc/sys
ProtectKernelModules=true # Block kernel module loading
ProtectControlGroups=true # Block cgroup manipulation
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX # Restrict socket families
RestrictNamespaces=true # Block namespace creation
SystemCallFilter=@system-service # Whitelist common syscalls; block dangerous ones
# --- Timeout ---
TimeoutStartSec=30s # Fail if not ready within 30s (for Type=notify)
TimeoutStopSec=30s # Force-kill after 30s if graceful stop takes too long
[Install]
WantedBy=multi-user.target # Enable via: systemctl enable myapp
EnvironmentFile Pattern for Secrets
# /etc/myapp/environment (mode 600, owned by root or myapp user)
DATABASE_URL=postgresql://myapp:secret@localhost:5432/myapp_prod
SECRET_KEY=your-256-bit-random-key-here
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
REDIS_URL=redis://:password@localhost:6379/0
# Set correct permissions
sudo install -m 600 -o root -g root /dev/stdin /etc/myapp/environment <<'EOF'
DATABASE_URL=...
EOF
# Or for apps running as a specific user
sudo install -m 640 -o root -g myapp /dev/stdin /etc/myapp/environment <<'EOF'
DATABASE_URL=...
EOF
The EnvironmentFile path in the unit file reads each KEY=VALUE line. Lines starting with # are ignored. A leading - makes the file optional: EnvironmentFile=-/etc/myapp/environment.
Timer Unit — Daily Backup Job
/etc/systemd/system/backup-myapp.service
[Unit]
Description=Daily backup of myapp database
After=network-online.target
Wants=network-online.
Установить systemd в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditBashFAQ
Что делает скилл systemd?
systemd unit file authoring and system management skill: service units, timer units, socket activation, drop-in overrides, journalctl, and security hardening options. USE WHEN: - Writing or modifying systemd service unit files for Node.js, Python, Go, or other apps - Setting up automatic restarts, dependency ordering, and environment variable loading - Creating timer units as a cron replacement for periodic tasks - Hardening a service with PrivateTmp, NoNewPrivileges, ProtectSystem=strict, etc. - Using drop-in overrides to modify upstream package-provided unit files - Debugging service startup failures, missing env vars, or timer misfires - Managing logs with journalctl (filtering, following, exporting) DO NOT USE FOR: - Docker container orchestration (use docker or kubernetes skill) - Application-level scheduling (job queues, cron-based business logic — use job-queues skill) - Full init system replacement on non-systemd distros (Alpine uses OpenRC) - Windows Task Scheduler or macOS launchd equivalents
Как установить скилл systemd?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл systemd запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic