Systemd.Install (systemd v0.1.0-pre.0)

Copy Markdown View Source

Helpers for installing generated unit files.

File writes are intentionally local filesystem operations. Reloading systemd is still performed through the D-Bus manager API, not through systemctl.

Summary

Functions

Writes a unit file and reloads systemd manager configuration over D-Bus.

Returns the target path for a unit name.

Writes a unit file to the selected target directory.

Types

target()

@type target() :: :system | :user | {:directory, Path.t()}

Functions

install_unit(name, unit_file_or_text, opts \\ [])

@spec install_unit(String.t(), Systemd.UnitFile.t() | String.t(), keyword()) ::
  {:ok, Path.t()} | {:error, Systemd.Error.t()}

Writes a unit file and reloads systemd manager configuration over D-Bus.

unit_path(name, target \\ :system)

@spec unit_path(String.t(), target()) :: Path.t()

Returns the target path for a unit name.

write_unit(name, unit_file_or_text, opts \\ [])

@spec write_unit(String.t(), Systemd.UnitFile.t() | String.t(), keyword()) ::
  {:ok, Path.t()} | {:error, Systemd.Error.t()}

Writes a unit file to the selected target directory.