Xamal.Commands.Systemd (xamal v0.3.1)

Copy Markdown View Source

Systemd service unit management commands.

Uses template units (<release>@.service) with the port as instance identifier, enabling blue-green deploys (myapp@4000 / myapp@4001), crash recovery via Restart=on-failure, and boot-time startup via systemctl enable.

Summary

Functions

Disable a service instance from boot-time startup.

Disable both port instances from boot-time startup.

Enable a service instance for boot-time startup.

Generate the systemd unit file content for a template service.

Write the template unit file and reload systemd.

Remove the unit file and reload systemd.

Start a service instance on the given port.

Stop a service instance on the given port.

Stop both port instances (tolerates failures via chain).

Create a symlink from env/app.env to the role-specific env file.

Functions

disable(config, port)

Disable a service instance from boot-time startup.

disable_all(config)

Disable both port instances from boot-time startup.

enable(config, port)

Enable a service instance for boot-time startup.

generate_unit_content(config)

Generate the systemd unit file content for a template service.

install_unit(config)

Write the template unit file and reload systemd.

remove_unit(config)

Remove the unit file and reload systemd.

start(config, port)

Start a service instance on the given port.

stop(config, port)

Stop a service instance on the given port.

stop_all(config)

Stop both port instances (tolerates failures via chain).

write_env_symlink(config, role)

Create a symlink from env/app.env to the role-specific env file.