#!/usr/bin/env nu # SPDX-License-Identifier: AGPL-3.0-only # Copyright (c) 2025 MatrixFurry # Starts a systemd service if it is not already started, otherwise do nothing. # Useful if you only want to ask for the password when the service actually needs # to be started. export def main [service: string] { if (systemctl is-active --quiet $service | complete).exit_code == 3 { systemctl start $service } }