# Systemd Services

> Create and manage systemd services and timers. Configure service dependencies and resource limits. Use when managing system services.

- Skill: `majiayu000/systemd-services` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/systemd-services`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/systemd-services/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/systemd-services

---


# Systemd Services

Manage system services with systemd.

## Service Unit File

```ini
# /etc/systemd/system/myapp.service
[Unit]
Description=My Application
After=network.target

[Service]
Type=simple
User=myapp
WorkingDirectory=/opt/myapp
ExecStart=/opt/myapp/bin/start
ExecStop=/opt/myapp/bin/stop
Restart=always
RestartSec=5
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
```

## Service Management

```bash
systemctl daemon-reload
systemctl start myapp
systemctl stop myapp
systemctl restart myapp
systemctl enable myapp
systemctl status myapp
journalctl -u myapp -f
```

## Timer (Cron Replacement)

```ini
# /etc/systemd/system/backup.timer
[Unit]
Description=Daily backup

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target
```

## Resource Limits

```ini
[Service]
MemoryLimit=512M
CPUQuota=50%
```

## Best Practices

- Use Type=notify for better tracking
- Implement proper restart policies
- Use timers instead of cron
- Set resource limits

