Project_Detail
All_Projects

svc

Simple SystemD Service Creation and Updater

View on GitHub
README.md

svc

svc is a small Go CLI for creating and updating systemd service units, then wrapping common systemctl lifecycle commands.

Features

  • Interactive create and update flows
  • Prompts default the run user to the current shell user
  • Generates service files in /etc/systemd/system by default
  • Wraps systemctl enable, disable, start, stop, restart, and status

Build

go build -o svc .

Usage

svc create my-app
svc update my-app
svc enable my-app
svc start my-app
svc restart my-app

create and update support flags for non-interactive use:

svc create my-app \
  --description "My application" \
  --exec "/usr/local/bin/my-app --serve" \
  --run-user "$USER" \
  --workdir /opt/my-app \
  --after network.target \
  --env APP_ENV=prod \
  --wanted-by multi-user.target

Because the default service directory is /etc/systemd/system, writing units and calling systemctl usually requires elevated privileges.