Systemd.Manager (systemd v0.1.0)

Copy Markdown View Source

Client for org.freedesktop.systemd1.Manager.

Summary

Functions

Connects to the system bus.

Gets the D-Bus object path for a loaded unit.

Gets the D-Bus object path for a unit by main process ID.

Sends a Unix signal to processes belonging to a unit.

Links unit files into systemd's search path.

Lists currently queued jobs.

Returns unit files known to systemd and their enablement state.

Lists currently loaded systemd units.

Reloads systemd manager configuration (daemon-reload).

Reloads a unit if supported, otherwise restarts it.

Reloads a unit if supported, otherwise tries to restart it only if active.

Reloads a unit and returns the queued systemd job.

Resets failed state for a unit.

Restarts a unit and returns the queued systemd job.

Starts a transient unit and returns the queued systemd job.

Starts a unit and returns the queued systemd job.

Stops a unit and returns the queued systemd job.

Tries to restart a unit only if it is already active.

Returns the enablement state of a unit file.

Functions

connect(opts \\ [])

@spec connect(keyword()) :: {:ok, pid()} | {:error, Systemd.Error.t()}

Connects to the system bus.

disable_unit_files(conn, files, opts \\ [])

@spec disable_unit_files(pid(), [String.t()], keyword()) ::
  {:ok, Systemd.UnitFileOperation.t()} | {:error, Systemd.Error.t()}

Disables unit files.

enable_unit_files(conn, files, opts \\ [])

@spec enable_unit_files(pid(), [String.t()], keyword()) ::
  {:ok, Systemd.UnitFileOperation.t()} | {:error, Systemd.Error.t()}

Enables unit files.

get_unit(conn, unit_name)

@spec get_unit(pid(), String.t()) ::
  {:ok, Systemd.UnitObject.t()} | {:error, Systemd.Error.t()}

Gets the D-Bus object path for a loaded unit.

get_unit_by_pid(conn, pid)

@spec get_unit_by_pid(pid(), non_neg_integer()) ::
  {:ok, Systemd.UnitObject.t()} | {:error, Systemd.Error.t()}

Gets the D-Bus object path for a unit by main process ID.

kill_unit(conn, unit_name, who \\ "all", signal \\ 15)

@spec kill_unit(pid(), String.t(), String.t(), integer()) ::
  :ok | {:error, Systemd.Error.t()}

Sends a Unix signal to processes belonging to a unit.

list_jobs(conn)

@spec list_jobs(pid()) :: {:ok, [Systemd.JobStatus.t()]} | {:error, Systemd.Error.t()}

Lists currently queued jobs.

list_unit_files(conn)

@spec list_unit_files(pid()) ::
  {:ok, [Systemd.UnitFileStatus.t()]} | {:error, Systemd.Error.t()}

Returns unit files known to systemd and their enablement state.

list_units(conn_or_opts \\ [])

@spec list_units(pid() | keyword()) ::
  {:ok, [Systemd.Unit.t()]} | {:error, Systemd.Error.t()}

Lists currently loaded systemd units.

Accepts either an existing D-Bus connection PID or connection options. Passing options opens a short-lived connection.

mask_unit_files(conn, files, opts \\ [])

@spec mask_unit_files(pid(), [String.t()], keyword()) ::
  {:ok, Systemd.UnitFileOperation.t()} | {:error, Systemd.Error.t()}

Masks unit files.

reload(conn)

@spec reload(pid()) :: :ok | {:error, Systemd.Error.t()}

Reloads systemd manager configuration (daemon-reload).

reload_or_restart_unit(conn, unit_name, opts \\ [])

@spec reload_or_restart_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Reloads a unit if supported, otherwise restarts it.

reload_or_try_restart_unit(conn, unit_name, opts \\ [])

@spec reload_or_try_restart_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Reloads a unit if supported, otherwise tries to restart it only if active.

reload_unit(conn, unit_name, opts \\ [])

@spec reload_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Reloads a unit and returns the queued systemd job.

reset_failed_unit(conn, unit_name)

@spec reset_failed_unit(pid(), String.t()) :: :ok | {:error, Systemd.Error.t()}

Resets failed state for a unit.

restart_unit(conn, unit_name, opts \\ [])

@spec restart_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Restarts a unit and returns the queued systemd job.

start_transient_unit(conn, unit_name, properties, opts \\ [])

@spec start_transient_unit(
  pid(),
  String.t(),
  [Systemd.TransientUnit.Property.t()],
  keyword()
) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Starts a transient unit and returns the queued systemd job.

start_unit(conn, unit_name, opts \\ [])

@spec start_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Starts a unit and returns the queued systemd job.

stop_unit(conn, unit_name, opts \\ [])

@spec stop_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Stops a unit and returns the queued systemd job.

try_restart_unit(conn, unit_name, opts \\ [])

@spec try_restart_unit(pid(), String.t(), keyword()) ::
  {:ok, Systemd.Job.t()} | {:error, Systemd.Error.t()}

Tries to restart a unit only if it is already active.

unit_file_state(conn, unit_name)

@spec unit_file_state(pid(), String.t()) ::
  {:ok, String.t()} | {:error, Systemd.Error.t()}

Returns the enablement state of a unit file.

unmask_unit_files(conn, files, opts \\ [])

@spec unmask_unit_files(pid(), [String.t()], keyword()) ::
  {:ok, Systemd.UnitFileOperation.t()} | {:error, Systemd.Error.t()}

Unmasks unit files.