fix: add gateway stop/restart commands

This commit is contained in:
Peter Steinberger
2026-01-06 03:25:21 +01:00
parent cc0ef4d012
commit 0398f684e7
18 changed files with 339 additions and 28 deletions

View File

@@ -3,6 +3,7 @@ import {
isLaunchAgentLoaded,
readLaunchAgentProgramArguments,
restartLaunchAgent,
stopLaunchAgent,
uninstallLaunchAgent,
} from "./launchd.js";
import {
@@ -10,6 +11,7 @@ import {
isScheduledTaskInstalled,
readScheduledTaskCommand,
restartScheduledTask,
stopScheduledTask,
uninstallScheduledTask,
} from "./schtasks.js";
import {
@@ -17,6 +19,7 @@ import {
isSystemdServiceEnabled,
readSystemdServiceExecStart,
restartSystemdService,
stopSystemdService,
uninstallSystemdService,
} from "./systemd.js";
@@ -37,6 +40,7 @@ export type GatewayService = {
env: Record<string, string | undefined>;
stdout: NodeJS.WritableStream;
}) => Promise<void>;
stop: (args: { stdout: NodeJS.WritableStream }) => Promise<void>;
restart: (args: { stdout: NodeJS.WritableStream }) => Promise<void>;
isLoaded: (args: {
env: Record<string, string | undefined>;
@@ -59,6 +63,9 @@ export function resolveGatewayService(): GatewayService {
uninstall: async (args) => {
await uninstallLaunchAgent(args);
},
stop: async (args) => {
await stopLaunchAgent(args);
},
restart: async (args) => {
await restartLaunchAgent(args);
},
@@ -78,6 +85,9 @@ export function resolveGatewayService(): GatewayService {
uninstall: async (args) => {
await uninstallSystemdService(args);
},
stop: async (args) => {
await stopSystemdService(args);
},
restart: async (args) => {
await restartSystemdService(args);
},
@@ -97,6 +107,9 @@ export function resolveGatewayService(): GatewayService {
uninstall: async (args) => {
await uninstallScheduledTask(args);
},
stop: async (args) => {
await stopScheduledTask(args);
},
restart: async (args) => {
await restartScheduledTask(args);
},