mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
1.6 KiB
1.6 KiB
NS.kill() method
Terminate the script(s) with the provided filename, host, and script arguments.
Signature:
kill(filename: string, host?: string, ...args: ScriptArg[]): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
filename |
string |
Filename of the script to kill. |
|
host |
string |
(Optional) Hostname/IP where the script to kill is running. Defaults to the current server. |
|
args |
Arguments of the script to kill. |
Returns:
boolean
True if the scripts were successfully killed, and false otherwise.
Remarks
RAM cost: 0.5 GB
Kills the script(s) with the provided filename, running on the specified host with the specified args. To instead kill a script using its PID, see the other ns.kill entry.
Example
// kill the script "foo.js" on the same server the current script is running from, with no arguments
ns.kill("foo.js");
// kill the script "foo.js" on the "n00dles" server with no arguments.
ns.kill("foo.js", "n00dles");
// kill the script foo.js on the current server that was run with the arguments [1, “foodnstuff”, false]:
ns.kill("foo.js", ns.getHostname(), 1, "foodnstuff", false);