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:
Unit Types
mkunit supports all the common systemd unit types:
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
serviceCreate a service unittimerCreate a timer unitpathCreate a path watchersocketCreate a socket unitmountCreate a mount unittargetCreate a target unitstatusCheck unit statuslogsView unit logseditEdit an installed unitenableEnable on bootdisableDisable on bootstart/stopStart or stop unitSecurity 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.