Files
pipelines/scripts/manage.py
T
alan fc7dbb0ac0 Remove ntfy: notifications go only through the app notification stream
Server: drop ntfy publishing (stage hooks, run outbox, chat attention, chat
tool notify, auto-switch and schedule notices), the chat push outbox (its
table is dropped at startup), ntfy status/endpoints and PIPELINES_NTFY_*.
The app_notifications stream, subscribe/clear and kinds are unchanged.
Notification settings keep run_finished/chat_needs_you/chat_reply_finished;
ntfy_enabled is accepted and ignored and its stored row is never read.

Stage type=ntfy is rejected: "ntfy stages were removed; notifications go to
the Pipelines apps — use the stage notify hook". The notify hook remains.

Installer: no ntfy build, accounts, config or supervisor child; manifest
gets top-level "mode" (legacy ntfy.mode still read). Reinstall retires an
old ntfy (safe PID-file stop, deletes binary, config, data dir, token, log,
with a note in logs/install.log); uninstall cleans leftovers.

App: ntfy settings section replaced by "Notification events"; texts updated.
Docs: docs/ntfy.md folded into docs/notifications.md; install, docker, cli,
author skill references updated; security review M1 marked resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:24:24 +00:00

618 lines
28 KiB
Python

#!/usr/bin/env python3
"""One per-user lifecycle for the server and the authenticated web proxy."""
import argparse
import fcntl
import json
import os
from pathlib import Path
import platform
import plistlib
import re
import shutil
import signal
import subprocess
import sys
import time
import urllib.request
DEFAULT_PREFIX = Path.home() / ".local/share/pipelines"
MARKER = "pipelines-install.json"
SERVICE_MARKER = "Managed by Pipelines native installer"
def install_mode(config):
""""native" for the native installer's manifest, else "docker".
Manifests record a top-level "mode"; ones written before it marked a native
install with ntfy.mode, which is still accepted until the next ./install."""
return config.get("mode") or (config.get("ntfy") or {}).get("mode") or "docker"
def server_address(config):
"""The -addr the server binds.
The bind address is a manifest setting so the phone client can reach the
server over the LAN; manifests written before it existed default to loopback.
"""
return f"{config.get('bind_address') or '127.0.0.1'}:{config['server_port']}"
def server_token_env(config):
"""PIPELINES_SERVER_TOKEN_FILE for the server, the web proxy and the CLI."""
path = (config.get("web") or {}).get("server_token_file")
return {"PIPELINES_SERVER_TOKEN_FILE": path} if path else {}
def mdns_args(config):
"""The LAN port the server advertises over mDNS.
LAN clients dial the authenticated web proxy, not the loopback server, so
the proxy's port is advertised when the proxy listens beyond loopback.
"""
web = config.get("web") or {}
if web.get("port") and web.get("host") not in (None, "", "127.0.0.1", "localhost", "::1"):
# Loopback + tailnet: the advert carries only the tailnet/public routes.
lan = web.get("host") != "tailnet" or web.get("lan") is True
return ["-mdns-port", str(web["port"])] + ([] if lan else ["-mdns-lan=false"])
return []
def web_listen_args(web):
"""The proxy's bind and access flags. "tailnet" (the installer default)
binds the wildcard and admits only loopback and tailnet connections, plus
the LAN when web.lan is set; sign-in over plain-HTTP LAN additionally needs
web.lan_plain_login. A literal address is bound as before, unfiltered."""
if web.get("host") != "tailnet":
return ["--host", web["host"]]
lan = web.get("lan") is True
return (["--host", "::", "--allow", "loopback,tailnet" + (",lan" if lan else "")]
+ (["--lan-plain-login"] if lan and web.get("lan_plain_login") is True else []))
def load(prefix):
prefix = Path(prefix).expanduser().resolve()
path = prefix / MARKER
if not path.is_file() or path.is_symlink() or path.stat().st_uid != os.getuid():
raise ValueError("Not a managed Pipelines installation owned by this user")
config = json.loads(path.read_text())
if config.get("format") != 1 or config.get("prefix") != str(prefix):
raise ValueError("Invalid installation manifest; refusing to manage paths")
return config
def run(args, *, env=None, quiet=False, check=True, timeout=120):
result = subprocess.run(args, env=env, capture_output=True, text=True, timeout=timeout)
if check and result.returncode:
# No subprocess output here: tool output may contain secrets.
raise RuntimeError(f"Command failed ({result.returncode}): {args[0]} {args[1] if len(args)>1 else ''}")
if not quiet and result.stdout:
print(result.stdout.rstrip())
return result
def compose(config, *args, **kwargs):
return run([config["docker"], "compose", "--project-name", config["project"],
"--file", str(Path(config["prefix"]) / "compose.yaml"), *args], **kwargs)
def healthy(url):
try:
with urllib.request.urlopen(url, timeout=2) as response:
return response.status == 200 and json.load(response).get("healthy") is True
except (OSError, ValueError):
return False
def wait_health(url, timeout=40):
end = time.monotonic() + timeout
while time.monotonic() < end:
if healthy(url):
return
time.sleep(0.25)
raise RuntimeError(f"Service did not become healthy: {url}; see pipelines logs")
def process_command(pid):
"""Return the OS command line for a live PID, or None when it cannot be read."""
try:
return subprocess.check_output(["ps", "-p", str(pid), "-o", "command="], text=True)
except (OSError, subprocess.CalledProcessError):
return None
def managed_pid(config):
path = Path(config["prefix"]) / "supervisor.pid"
try:
pid = int(path.read_text())
except (OSError, ValueError):
return None
if pid <= 1:
return None
command = process_command(pid)
# Never signal an arbitrary/reused PID.
if command is None or str(Path(config["prefix"]) / "lib/manage.py") not in command or "supervise" not in command:
return None
return pid
def registration(config):
return config.get("registration")
def service_command(config, arguments):
parser = argparse.ArgumentParser(prog="pipelines service",
description="Manage this native installation's server and authenticated web login service.")
parser.add_argument("action", choices=("enable", "disable", "status"))
parser.add_argument("--print", dest="preview", action="store_true",
help="Preview enable's existing service definition without changing or starting anything")
if not arguments or arguments == ["help"]:
parser.print_help()
return
args = parser.parse_args(arguments)
if args.preview and args.action != "enable":
parser.error("--print is only supported with enable")
if install_mode(config) != "native" or config.get("label") != "net.a-wan.pipelines" or not registration(config):
raise ValueError("No native installer login service is recorded; rerun ./install")
path = Path(registration(config))
if platform.system() == "Darwin":
expected = Path.home() / "Library/LaunchAgents/net.a-wan.pipelines.plist"
elif platform.system() == "Linux":
root = Path(config.get("opencode_env", {}).get("XDG_CONFIG_HOME") or Path.home() / ".config")
expected = root / "systemd/user/net.a-wan.pipelines.service"
else:
raise ValueError("Native login services require macOS launchd or Linux systemd --user")
if (path != expected or path.is_symlink() or not path.is_file()
or path.stat().st_uid != os.getuid()):
raise ValueError("Refusing an unexpected native service definition path or owner")
content = path.read_text()
if SERVICE_MARKER not in content:
raise ValueError("Refusing an unmanaged or standalone developer service definition")
if platform.system() == "Darwin":
definition = plistlib.loads(content.encode())
command = [config["python"], str(Path(config["prefix"]) / "lib/manage.py"),
"supervise", "--prefix", config["prefix"]]
if definition.get("Label") != config["label"] or definition.get("ProgramArguments") != command:
raise ValueError("Native service definition does not match this installation")
else:
def quote(value):
return '"' + value.replace('\\', '\\\\').replace('"', '\\"').replace('%', '%%').replace('$', '$$') + '"'
command = [config["python"], str(Path(config["prefix"]) / "lib/manage.py"),
"supervise", "--prefix", config["prefix"]]
if "ExecStart=" + " ".join(map(quote, command)) not in content.splitlines():
raise ValueError("Native service definition does not match this installation")
if args.preview:
print(content, end="")
elif args.action == "enable":
start(config)
print("Native login autostart enabled: server and authenticated web.")
elif args.action == "disable":
if platform.system() == "Darwin":
run(["launchctl", "disable", f"gui/{os.getuid()}/{config['label']}"], quiet=True)
else:
run(["systemctl", "--user", "disable", config["label"] + ".service"], quiet=True)
stop(config)
print("Native login autostart disabled; supervisor stopped. Data and credentials retained.")
elif platform.system() == "Darwin":
domain = f"gui/{os.getuid()}"
disabled = run(["launchctl", "print-disabled", domain], quiet=True)
enabled = not re.search(r'"' + re.escape(config["label"]) + r'"\s*=>\s*true', disabled.stdout)
active = run(["launchctl", "print", domain + "/" + config["label"]], quiet=True, check=False).returncode == 0
print("Autostart:", "enabled" if enabled else "disabled")
print("Supervisor:", "loaded" if active else "not loaded")
else:
enabled = run(["systemctl", "--user", "is-enabled", config["label"] + ".service"], quiet=True, check=False)
active = run(["systemctl", "--user", "is-active", config["label"] + ".service"], quiet=True, check=False)
print("Autostart:", "enabled" if enabled.returncode == 0 else "disabled")
print("Supervisor:", "active" if active.returncode == 0 else "inactive")
def require_web_app(config):
"""The server never runs without its web app: both or neither."""
web = config.get("web") or {}
root = Path(web["root"]) if web.get("root") else None
if root is None or not (root / "index.html").is_file():
raise RuntimeError("The web app is not installed" + (f" in {root}" if root else "")
+ "; refusing to start the server without it. Run ./install.")
def start(config):
require_web_app(config)
root = Path(config["prefix"])
if registration(config):
if platform.system() == "Darwin":
target = f"gui/{os.getuid()}/{config['label']}"
run(["launchctl", "enable", target], quiet=True)
if run(["launchctl", "print", target], quiet=True, check=False).returncode:
run(["launchctl", "bootstrap", f"gui/{os.getuid()}", registration(config)], quiet=True)
run(["launchctl", "kickstart", target], quiet=True)
else:
run(["systemctl", "--user", "daemon-reload"], quiet=True)
run(["systemctl", "--user", "enable", "--now", config["label"] + ".service"], quiet=True)
elif managed_pid(config) is None:
log = (root / "logs/supervisor.log").open("a")
subprocess.Popen([config["python"], str(root / "lib/manage.py"), "supervise", "--prefix", str(root)],
stdin=subprocess.DEVNULL, stdout=log, stderr=log, start_new_session=True)
log.close()
wait_health(f"http://127.0.0.1:{config['server_port']}/healthz", timeout=75)
if config.get("web"):
web = config["web"]
host = "127.0.0.1" if web["host"] in ("0.0.0.0", "tailnet") else web["host"]
end = time.monotonic() + 20
while True:
try:
with urllib.request.urlopen(f"http://{host}:{web['port']}/login", timeout=2) as response:
if response.status == 200:
break
except OSError:
pass
if time.monotonic() >= end:
raise RuntimeError("Web proxy did not become ready; see logs/web.log")
time.sleep(0.25)
def stop(config):
if registration(config):
if platform.system() == "Darwin":
run(["launchctl", "bootout", f"gui/{os.getuid()}", registration(config)], quiet=True, check=False)
else:
run(["systemctl", "--user", "stop", config["label"] + ".service"], quiet=True)
pid = managed_pid(config)
if pid is not None:
os.kill(pid, signal.SIGTERM)
deadline = time.monotonic() + 80
while managed_pid(config) is not None and time.monotonic() < deadline:
time.sleep(0.2)
if managed_pid(config) is not None:
raise RuntimeError("Supervisor did not stop; inspect logs before trying again")
# Installs from before ntfy was removed ran it beside the server.
stop_legacy_ntfy(config)
# --- retired ntfy ---------------------------------------------------------
# Pipelines no longer runs ntfy: notifications reach the apps through the
# server's own notification stream. Older installs left a supervised ntfy
# process, its binary, configuration, data and publishing token behind; these
# helpers stop and remove exactly those, idempotently.
def legacy_ntfy_pid(config):
"""The PID in <prefix>/ntfy.pid while it is still the managed `ntfy serve`.
Never an arbitrary/reused PID: the command line must run <prefix>/bin/ntfy
(or the binary the old manifest recorded, or a symlink-resolved form, so a
prefix reached through a symlinked HOME such as macOS /var → /private/var
still matches) with `serve`. A reaped or zombie process no longer matches."""
root = Path(config["prefix"])
try:
pid = int((root / "ntfy.pid").read_text())
except (OSError, ValueError):
return None
if pid <= 1:
return None
command = process_command(pid)
binaries = {str(root / "bin/ntfy"), str((root / "bin/ntfy").resolve())}
recorded = (config.get("ntfy") or {}).get("bin")
if recorded:
binaries.update((str(recorded), str(Path(recorded).resolve())))
if command is None or "serve" not in command.split() or not any(binary in command for binary in binaries):
return None
return pid
def stop_legacy_ntfy(config, timeout=10):
"""Stops a leftover managed ntfy and forgets its PID file; True if one ran."""
pid = legacy_ntfy_pid(config)
if pid is not None:
try:
os.kill(pid, signal.SIGTERM)
except ProcessLookupError:
pid = None
deadline = time.monotonic() + timeout
while pid is not None and legacy_ntfy_pid(config) == pid and time.monotonic() < deadline:
time.sleep(0.1)
if pid is not None and legacy_ntfy_pid(config) == pid:
try:
os.kill(pid, signal.SIGKILL)
except ProcessLookupError:
pass
(Path(config["prefix"]) / "ntfy.pid").unlink(missing_ok=True)
return pid is not None
def legacy_ntfy_paths(root):
"""Everything an older install created for ntfy under the prefix."""
root = Path(root)
return [root / "bin/ntfy", root / "ntfy.pid", root / "logs/ntfy.log",
root / "data/ntfy", root / "secrets/publisher-token"]
def retire_ntfy(config, note=print):
"""Stops and removes an older install's ntfy; a no-op once it is gone.
``config`` is the old manifest (or any dict with "prefix"). Before anything
is removed ``note`` receives a line naming what goes (paths and the old
ntfy version, never credentials). Only the fixed paths under the prefix are
removed, never paths read from the manifest. Returns the removed paths."""
root = Path(config["prefix"])
present = [path for path in legacy_ntfy_paths(root) if path.exists() or path.is_symlink()]
legacy = config.get("ntfy") or {}
if not present and not legacy:
stop_legacy_ntfy(config)
return []
version = legacy.get("version") or "unknown"
note(f"Retiring ntfy (version {version}); Pipelines no longer uses it. Removing: "
+ (", ".join(map(str, present)) or "nothing left on disk") + ".")
if stop_legacy_ntfy(config):
note("Stopped the old ntfy server process.")
if install_mode(config) != "native" and (root / "compose.yaml").is_file() and config.get("docker") and config.get("project"):
compose(config, "rm", "--stop", "--force", "ntfy", quiet=True, check=False)
for path in present:
if path.is_dir() and not path.is_symlink():
shutil.rmtree(path)
else:
path.unlink(missing_ok=True)
return present
def server_report(config):
"""The server's own startup report: the last `== Pipelines server` block
it wrote to its log."""
log = Path(config["prefix"]) / "logs/server.log"
try:
with log.open("rb") as handle:
handle.seek(max(0, log.stat().st_size - 64 * 1024))
lines = handle.read().decode("utf-8", "replace").splitlines()
except OSError:
return []
starts = [i for i, line in enumerate(lines) if line.startswith("== Pipelines server")]
if not starts:
return []
block = []
for line in lines[starts[-1]:]:
block.append(line)
if line == "==":
break
return block
def report(config):
"""Prints what is running: server, backends, web app and phone access."""
for line in server_report(config):
print(line)
web = config.get("web")
if web:
public = (config.get("opencode_env") or {}).get("PIPELINES_WEB_PUBLIC_URL")
print("== Access")
address = public or f"http://{'127.0.0.1' if web['host'] == 'tailnet' else web['host']}:{web['port']}"
print(f" {'Web':<10} {address} (password in {web['auth_file']})")
root = Path(web["root"]) if web.get("root") else None
built = root is not None and (root / "index.html").is_file()
print(f" {'Web app':<10} {'installed' if built else 'MISSING; the server will not start until ./install builds it'}")
updates = Path(web["updates"]) if web.get("updates") else None
apk = updates is not None and (updates / "pipelines.apk").is_file()
print(f" {'Phone app':<10} " + (f"{updates / 'pipelines.apk'} (Settings → Check for updates)"
if apk else "not built; run ./install --apk"))
print("==")
def active_runs(config):
"""Runs the server is still executing; an update waits for them."""
binary = str(Path(config["prefix"]) / "bin/pipelines")
result = run([binary, "--url", f"ws://127.0.0.1:{config['server_port']}/connect", "runs", "--json"],
quiet=True, check=False, timeout=60)
if result.returncode:
return None
try:
data = json.loads(result.stdout)
except ValueError:
return None
runs = data.get("runs", []) if isinstance(data, dict) else data
return [item for item in runs if isinstance(item, dict) and item.get("executing")]
def update(config):
"""Brings this installation to the newest source: pull, reinstall the same
way it was installed (data and credentials kept), restart, report."""
source = Path(config.get("source") or "")
# No recorded source must not fall back to the current directory.
if not config.get("source") or not (source / "install.sh").is_file():
raise ValueError("This installation does not record its source checkout; "
"run ./install from your Pipelines checkout to update it")
if healthy(f"http://127.0.0.1:{config['server_port']}/healthz"):
active = active_runs(config)
if active is None:
raise RuntimeError("Could not read the server's runs; update after checking `pipelines runs`")
if active:
raise RuntimeError(f"{len(active)} run(s) are still executing; update after they finish")
if (source / ".git").exists():
upstream = subprocess.run(["git", "-C", str(source), "rev-parse", "--abbrev-ref", "@{u}"],
capture_output=True, text=True)
if upstream.returncode:
print("The checkout tracks no upstream branch; installing it as it is.")
else:
pulled = subprocess.run(["git", "-C", str(source), "pull", "--ff-only"], text=True)
if pulled.returncode:
raise RuntimeError("git pull --ff-only failed; resolve the checkout, then rerun `pipelines update`")
installed = subprocess.run(["sh", str(source / "install.sh"), *config.get("install_args", [])])
if installed.returncode:
raise RuntimeError("The installer failed; the previous version keeps running")
config = load(config["prefix"])
stop(config)
start(config)
report(config)
def supervise(config):
root = Path(config["prefix"])
with (root / "supervisor.lock").open("a") as lock:
try:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
except BlockingIOError:
return
pidfile = root / "supervisor.pid"
pidfile.write_text(str(os.getpid()))
stopped = False
child = None
web_child = None
def stopping(*_):
nonlocal stopped
stopped = True
for process in (child, web_child):
if process is not None and process.poll() is None:
process.terminate()
signal.signal(signal.SIGTERM, stopping)
signal.signal(signal.SIGINT, stopping)
try:
require_web_app(config)
# An ntfy an older supervisor left running is stopped, not reused.
stop_legacy_ntfy(config)
if stopped:
return
env = {key: value for key, value in os.environ.items() if not key.startswith("PIPELINES_NTFY_")}
env.update(config.get("opencode_env", {}))
env.update(HOME=str(Path.home()), PATH=config["path"], TZ=config["timezone"])
# The server requires, and the proxy and every child CLI send, the
# shared token in this file (installs from before it have none).
env.update(server_token_env(config))
if config.get("web"):
# The server verifies step-up re-authentication against the
# web sign-in password file (read-only).
env["PIPELINES_WEB_AUTH_FILE"] = config["web"]["auth_file"]
server_command = [str(root / "bin/pipelines-server"), "-addr",
server_address(config), "-db", str(root / "data/pipelines.db")]
if config.get("allow_authoring") is True:
server_command.append("-allow-authoring")
server_command += mdns_args(config)
with (root / "logs/server.log").open("a") as log:
child = subprocess.Popen(server_command, cwd=config["workspace"], env=env, stdout=log, stderr=log)
if config.get("web"):
web = config["web"]
web_env = dict(env)
web_env.pop("PIPELINES_WEB_AUTH", None)
web_env["PIPELINES_WEB_AUTH_FILE"] = web["auth_file"]
with (root / "logs/web.log").open("a") as web_log:
web_child = subprocess.Popen(
[web["node"], web["script"], "--port", str(web["port"]),
*web_listen_args(web), "--pipelines", f"127.0.0.1:{config['server_port']}",
*(["--root", web["root"]] if web.get("root") else []),
*(["--updates", web["updates"]] if web.get("updates") else [])],
env=web_env, stdout=web_log, stderr=web_log)
while child.poll() is None and not stopped:
if web_child is not None and web_child.poll() is not None:
raise RuntimeError("Authenticated web proxy exited; see logs/web.log")
time.sleep(0.25)
if not stopped and child.returncode:
raise RuntimeError("Pipeline server exited; see logs/server.log")
finally:
if web_child is not None and web_child.poll() is None:
web_child.terminate()
try:
web_child.wait(timeout=10)
except subprocess.TimeoutExpired:
web_child.kill()
web_child.wait()
if child is not None and child.poll() is None:
child.terminate()
try:
child.wait(timeout=70)
except subprocess.TimeoutExpired:
child.kill()
child.wait()
pidfile.unlink(missing_ok=True)
def uninstall(config, purge=False, yes=False):
root = Path(config["prefix"])
if not yes and input("Uninstall Pipelines? [y/N] ").strip().lower() != "y":
return
if purge and not yes and input("Also DELETE pipeline history and credentials? Type DELETE: ") != "DELETE":
raise ValueError("Purge canceled; nothing deleted")
stop(config)
if registration(config):
if platform.system() != "Darwin":
run(["systemctl", "--user", "disable", config["label"] + ".service"], quiet=True, check=False)
Path(registration(config)).unlink(missing_ok=True)
# Anything an older install left for ntfy goes too, manifest or not.
retire_ntfy(config)
if install_mode(config) != "native" and (root / "compose.yaml").is_file():
compose(config, "down", "--remove-orphans", *(["--volumes"] if purge else []), quiet=True)
link = Path(config["launcher"])
if link.is_symlink() and link.resolve() == (root / "bin/pipelines").resolve():
if str(link)=="/usr/local/bin/pipelines" and not os.access(link.parent,os.W_OK):
subprocess.run(["sudo","rm",str(link)],check=True)
else:
link.unlink()
if purge:
# Only the explicitly identified, owned installation directory is removed.
shutil.rmtree(root)
print("Removed installation and its pipeline data. Host OpenCode was untouched.")
else:
for path in (root / "bin", root / "lib"):
if path.exists():
shutil.rmtree(path)
config["registration"] = None
config["uninstalled"] = True
(root / MARKER).write_text(json.dumps(config, indent=2))
print(f"Uninstalled. Data retained at {root}; reinstall to reuse it.")
def main():
lifecycle = ("start", "stop", "restart", "status", "doctor", "logs", "supervise", "uninstall", "update")
# Strip only the launcher's installation selector. All application arguments
# belong to the shared Go CLI (including global flags before the command).
selector = argparse.ArgumentParser(add_help=False)
selector.add_argument("--prefix", type=Path, default=DEFAULT_PREFIX)
selected, forwarded = selector.parse_known_args()
config = load(selected.prefix)
if forwarded and forwarded[0] in ("service", "native-service"):
service_command(config, forwarded[1:])
return
if not forwarded or forwarded[0] not in lifecycle:
binary = str(Path(config["prefix"]) / "bin/pipelines")
env = dict(os.environ)
env.update(config.get("opencode_env", {}))
env.update(PIPELINES_URL=f"ws://127.0.0.1:{config['server_port']}/connect",
PIPELINES_OPENCODE=config["opencode"], PATH=config["path"])
env.update(server_token_env(config))
os.execve(binary, [binary, *(forwarded or ["tui"])], env)
return
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("action", nargs="?", default="tui")
parser.add_argument("--prefix", type=Path, default=DEFAULT_PREFIX)
parser.add_argument("--purge", action="store_true")
parser.add_argument("--yes", action="store_true")
args, rest = parser.parse_known_args()
if args.action in lifecycle and rest:
parser.error("unexpected arguments: " + " ".join(rest))
if args.action == "start":
start(config)
report(config)
elif args.action == "stop":
stop(config)
elif args.action == "restart":
stop(config); start(config)
report(config)
elif args.action in ("status", "doctor"):
report(config)
print("Pipeline server:", "healthy" if healthy(f"http://127.0.0.1:{config['server_port']}/healthz") else "stopped/unhealthy")
if args.action == "doctor":
run([config["opencode"], "api", "get", "/api/info"], quiet=True)
print("Host OpenCode API: responding (model execution is a separate check)")
elif args.action == "logs":
os.execvp("tail", ["tail", "-n", "100", "-f", str(Path(config["prefix"]) / "logs/server.log")])
elif args.action == "update":
update(config)
elif args.action == "supervise":
supervise(config)
elif args.action == "uninstall":
uninstall(config, args.purge, args.yes)
if __name__ == "__main__":
try:
main()
except (ValueError, RuntimeError, OSError, subprocess.SubprocessError) as error:
sys.exit(str(error))