Skip to content

Systemctl

Index

systemctl::is_user_unit_enabled

Predicate: is the named user-scope systemd unit enabled?

Arguments

  • $1 (unit): name (e.g. "foo.service")

Exit codes

  • 0: if enabled
  • 1: otherwise

systemctl::is_system_unit_enabled

Predicate: is the named system-scope systemd unit enabled?

Arguments

  • $1 (unit): name (e.g. "foo.service")

Exit codes

  • 0: if enabled
  • 1: otherwise

systemctl::user_service_unit_file_exists

Return true if a user systemd unit file with the given name exists.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

Exit codes

  • 0: if true
  • 1: if false

systemctl::system_service_unit_file_exists

Return true if a system systemd unit file with the given name exists.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

Exit codes

  • 0: if true
  • 1: if false

systemctl::enable_user_service_unit

Enable and start a user systemd service if its unit file exists and it is not already enabled.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

systemctl::enable_system_service_unit

Enable and start a system systemd service if its unit file exists and it is not already enabled.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

systemctl::disable_user_service_unit

Disable and stop a user systemd service if its unit file exists and it is currently enabled.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

systemctl::disable_system_service_unit

Disable and stop a system systemd service if its unit file exists and it is currently enabled.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

systemctl::restart_user_service_if_enabled

Restart a user systemd service if its unit file exists and it is currently enabled.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")

systemctl::restart_system_service_if_enabled

Restart a system systemd service if its unit file exists and it is currently enabled.

Arguments

  • $1 (service): unit file name (e.g. "foo.service")