Create systemd units in seconds, not minutes

mkunit is a CLI tool that takes the pain out of writing systemd unit files. Interactive or scriptable. One command, done.

$ mkunit service myapp --exec "./server" --restart on-failure --install
Created myapp.service
Installed to ~/.config/systemd/user/myapp.service
Run: systemctl --user start myapp

Writing systemd units shouldn't require a manual

Can't remember the INI syntax? Neither can we.

Was it /etc/systemd/system or /usr/lib/systemd/system?

daemon-reload, enable, start... in what order?

User service or system service? What's the path again?

mkunit handles the details

Focus on what your service does, not how systemd wants it configured.

All unit types

Services, timers, paths, sockets, mounts, and targets. Everything you need.

Interactive or scripted

Missing a flag? We'll ask. Have all flags? We won't bother you.

Smart defaults

Sensible restart policies, paths, and dependencies out of the box.

Validation

Warns about relative paths, missing executables, and common mistakes.

One binary

No runtime dependencies. Works on any Linux distro.

Security hardening

Built-in security options to sandbox your services properly.

How it works

Three steps. That's it.

1

Create

$ mkunit service myapp \
--exec "./server"
2

Install

$ mkunit service myapp \
--exec "./server" \
--install
3

Manage

$ mkunit status myapp
$ mkunit logs myapp -f
$ mkunit edit myapp

All the unit types you need

Create any type of systemd unit with a single command.

Don't remember the flags? Just run it.

mkunit prompts for missing options interactively.

$ mkunit service myapp

Service name: myapp
Command to run: ./server
Working directory [/home/alan/myapp]:
Restart policy [on-failure]:
User service or system? [user]:

Created myapp.service
Install now? [Y/n]: y
Installed to ~/.config/systemd/user/myapp.service

Before and after

See the difference mkunit makes.

Before (manual)
[Unit]
Description=myapp service
After=network.target

[Service]
Type=simple
ExecStart=/home/alan/myapp/server
WorkingDirectory=/home/alan/myapp
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target
After (mkunit)
mkunit service myapp \
  --exec "./server" \
  --install \
  --start

Installation

Get started in seconds.

$ cargo install mkunit