cleanup script
parent
892fc92251
commit
ef8cb5cb98
@ -0,0 +1,18 @@
|
|||||||
|
import { NS } from "@ns";
|
||||||
|
import { getControllerState } from "/lib/types-and-constants";
|
||||||
|
|
||||||
|
export async function main(ns : NS) : Promise<void> {
|
||||||
|
const [script] = ns.args
|
||||||
|
|
||||||
|
const datafileState = getControllerState(ns)
|
||||||
|
const adminServers = datafileState.knownServers.filter(s => s.hasAdminRights)
|
||||||
|
|
||||||
|
for(const server of adminServers) {
|
||||||
|
const processes = ns.ps(server.hostname)
|
||||||
|
|
||||||
|
for (const process of processes) {
|
||||||
|
if (process.filename === script)
|
||||||
|
ns.kill(process.pid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue