mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-14 03:33:52 +01:00
59 lines
1.6 KiB
Markdown
59 lines
1.6 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.md)
|
||
|
||
## NS.kill() method
|
||
|
||
Terminate another script.
|
||
|
||
<b>Signature:</b>
|
||
|
||
```typescript
|
||
kill(script: string | number, host: string, ...args: string[]): boolean;
|
||
```
|
||
|
||
## Parameters
|
||
|
||
| Parameter | Type | Description |
|
||
| --- | --- | --- |
|
||
| script | string \| number | Filename or pid of the script to kill |
|
||
| host | string | Hostname of the server on which to kill the script. |
|
||
| args | string\[\] | Arguments to identify which script to kill. |
|
||
|
||
<b>Returns:</b>
|
||
|
||
boolean
|
||
|
||
True if the script is successfully killed, and false otherwise.
|
||
|
||
## Remarks
|
||
|
||
RAM cost: 0.5 GB
|
||
|
||
Kills the script on the target server specified by the script’s name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code.
|
||
|
||
## Example 1
|
||
|
||
|
||
```ts
|
||
//The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
|
||
kill("foo.script", "foodnstuff");
|
||
```
|
||
|
||
## Example 2
|
||
|
||
|
||
```ts
|
||
//The following will try to kill a script named foo.script on the current server that was ran with no arguments:
|
||
kill("foo.script", getHostname());
|
||
```
|
||
|
||
## Example 3
|
||
|
||
|
||
```ts
|
||
//The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
|
||
kill("foo.script", getHostname(), 1, "foodnstuff");
|
||
```
|
||
|