← All Tools

Create systemd units in seconds, not minutes. No more copy-pasting boilerplate or hunting through documentation.

Why mkunit?

Writing systemd unit files by hand is tedious. You have to remember the correct section names, find the right options for your use case, and avoid common pitfalls. One typo and your service won't start.

mkunit handles the boilerplate so you can focus on what matters: the command you want to run. It validates your configuration, applies sensible defaults, and installs the unit file in the right place.

Multiple Unit Types

Create services, timers, path watchers, sockets, mounts, and targets. Each type has tailored options and smart defaults.

Interactive or Scripted

Run interactively and get prompted for missing options, or pass all flags at once for scripting and automation.

Built-in Validation

Catches common mistakes like relative paths, missing executables, and invalid configurations before they cause problems.

Security Hardening

Apply sandboxing options with a single flag. Restrict filesystem access, network, and capabilities without memorising directives.

Install

Install from crates.io:

cargo install mkunit

Or download a pre-built binary from the releases page.

Quick Start

Create a simple service that runs a script:

mkunit
# Create a service
mkunit service --name myapp --exec /usr/local/bin/myapp
 
# Install to systemd
mkunit service --name myapp --exec /usr/local/bin/myapp --install
 
# Check status
mkunit status myapp

Unit Types

mkunit supports all the common systemd unit types:

service timer path socket mount target

Services

Long-running daemons with restart policies:

mkunit service --name myapp --exec /usr/local/bin/myapp \
  --restart on-failure --user myapp --install

Timers

Scheduled tasks (like cron, but better):

mkunit timer --name backup --on-calendar "daily" \
  --exec /usr/local/bin/backup.sh --install

Path Watchers

Trigger actions when files change:

mkunit path --name deploy --watch /var/www/uploads \
  --exec /usr/local/bin/process-upload.sh --install

Commands

mkunit commands
serviceCreate a service unit
timerCreate a timer unit
pathCreate a path watcher
socketCreate a socket unit
mountCreate a mount unit
targetCreate a target unit
statusCheck unit status
logsView unit logs
editEdit an installed unit
enableEnable on boot
disableDisable on boot
start/stopStart or stop unit

Security Hardening

Apply sandboxing to your services with a single flag:

mkunit service --name myapp --exec /usr/local/bin/myapp --harden

This applies sensible security defaults: private /tmp, read-only filesystem where possible, no network if not needed, and restricted capabilities.

Learn More

For full documentation, examples, and advanced usage, visit mkunit.sh.

mkunit is open source and MIT licensed. Contributions welcome on GitHub.