mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-30 01:47:33 +01:00
08e71c732b
* Added new positive integer ns validation helper * `run`, `exec`, and `spawn` verify threads as a positive integer. * `run` terminal command also fails if the provided threadcount is not a positive integer. * Removed some references to .script files in various documentation, and removed some of the NS1 example blocks
49 lines
1.5 KiB
Markdown
49 lines
1.5 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [kill](./bitburner.ns.kill_1.md)
|
|
|
|
## NS.kill() method
|
|
|
|
Terminate the script with the provided filename, hostname, and script arguments.
|
|
|
|
**Signature:**
|
|
|
|
```typescript
|
|
kill(filename: string, hostname?: string, ...args: ScriptArg[]): boolean;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| filename | string | Filename of the script to kill. |
|
|
| hostname | string | _(Optional)_ Hostname where the script to kill is running. Defaults to the current server. |
|
|
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments of the script to kill. |
|
|
|
|
**Returns:**
|
|
|
|
boolean
|
|
|
|
True if the script is successfully killed, and false otherwise.
|
|
|
|
## Remarks
|
|
|
|
RAM cost: 0.5 GB
|
|
|
|
Kills the script 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](./bitburner.ns.kill.md)<!-- -->.
|
|
|
|
## Example
|
|
|
|
|
|
```js
|
|
// 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 ran with the arguments [1, “foodnstuff”, false]:
|
|
ns.kill("foo.js", ns.getHostname(), 1, "foodnstuff", false);
|
|
```
|
|
|