mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Check if the agents service is running before starting it
This commit is contained in:
parent
3958fcfcef
commit
2784dfd34e
1 changed files with 13 additions and 0 deletions
|
|
@ -146,6 +146,19 @@ function stopServiceIfRunning() {
|
|||
}
|
||||
|
||||
function startService() {
|
||||
try {
|
||||
// Check if service is already running
|
||||
ui.writeVerbose('Checking service status: sc query "SafeChainAgent"');
|
||||
const status = execSync('sc query "SafeChainAgent"', { encoding: "utf8" });
|
||||
|
||||
if (status.includes("RUNNING")) {
|
||||
ui.writeVerbose("SafeChain Agent service is already running.");
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// Service might not exist yet or query failed, proceed with start
|
||||
}
|
||||
|
||||
ui.writeVerbose('Running: net start "SafeChainAgent"');
|
||||
execSync('net start "SafeChainAgent"', { stdio: "inherit" });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue