https://github.com/saadnvd1/serviceman
Lightweight process manager with auto-restart, logging, and launchd integration. Single-file Python, zero dependencies.
https://github.com/saadnvd1/serviceman
cli daemon launchd process-manager python zero-dependencies
Last synced: about 2 months ago
JSON representation
Lightweight process manager with auto-restart, logging, and launchd integration. Single-file Python, zero dependencies.
- Host: GitHub
- URL: https://github.com/saadnvd1/serviceman
- Owner: saadnvd1
- License: mit
- Created: 2026-04-25T04:13:24.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-25T04:18:34.000Z (2 months ago)
- Last Synced: 2026-04-25T06:20:00.679Z (2 months ago)
- Topics: cli, daemon, launchd, process-manager, python, zero-dependencies
- Language: Python
- Homepage: https://saadnaveed.com
- Size: 202 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serviceman
> Lightweight process manager with auto-restart, logging, and launchd integration
## Install
```sh
git clone https://github.com/saadnvd1/serviceman.git
cd serviceman
./install.sh
```
Make sure `~/bin` is in your `PATH`.
## Usage
```sh
sm [options]
```
### Commands
| Command | Description |
|---------|-------------|
| `add ""` | Register a service (`-c` for working dir) |
| `start ` | Start a service |
| `stop ` | Stop a service |
| `restart ` | Restart a service |
| `status [name]` | Show status (all or specific) |
| `list` | List all services |
| `logs ` | View logs (`-n` lines, `-f` follow, `--clear`) |
| `edit ` | Modify config (`-c` cmd, `-w` dir) |
| `enable ` | Auto-start on login (macOS launchd) |
| `disable ` | Remove from login items |
| `remove ` | Unregister a service |
| `start-all` | Start all services |
| `stop-all` | Stop all services |
| `restart-all` | Restart all services |
### Examples
```sh
# Run a web server with auto-restart
sm add myapp "npm start" -c /path/to/project
sm start myapp
# Check what's running
sm list
# Follow logs
sm logs myapp -f
# Start on login
sm enable myapp
```
## How it works
Single Python daemon (`smd`) manages all child processes via a Unix socket. The CLI (`sm`) sends commands to the daemon. Crashed services auto-restart with exponential backoff (1s → 30s). Combined stdout/stderr captured per-service in `~/.serviceman/logs/`.
## Features
- **Auto-restart** on crash with exponential backoff
- **Combined logging** — stdout and stderr per service
- **launchd integration** — auto-start on macOS login
- **Single file**, zero dependencies, Python stdlib only
## Storage
All state lives in `~/.serviceman/`:
| Path | Contents |
|------|----------|
| `services.json` | Service definitions |
| `pids/` | PID files |
| `logs/` | Per-service log files |
## Related
- [harry-bot](https://github.com/saadnvd1/harry-bot) - Personal AI assistant that uses serviceman for deployment
## License
MIT