cleanup script

main
Ashelyn Dawn 6 months ago
parent 892fc92251
commit ef8cb5cb98
No known key found for this signature in database
GPG Key ID: D1980B8C6F349BC1

@ -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…
Cancel
Save