2019-03-03 04:08:54 +01:00
|
|
|
ps() Netscript Function
|
|
|
|
=======================
|
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. js:function:: ps([hostname=current hostname])
|
2019-03-03 04:08:54 +01:00
|
|
|
|
|
|
|
:RAM cost: 0.2 GB
|
2021-03-12 08:51:56 +01:00
|
|
|
:param string hostname: Hostname address of the target server.
|
|
|
|
If not specified, it will be the current server's IP by default.
|
|
|
|
:returns: array of object
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
Returns an array with general information about all scripts running on the
|
|
|
|
specified target server. The information for each server is given in an
|
|
|
|
object with the following structure::
|
2019-03-03 04:08:54 +01:00
|
|
|
|
|
|
|
{
|
2021-03-12 08:51:56 +01:00
|
|
|
filename: Script name,
|
|
|
|
threads: Number of threads script is running with,
|
2021-05-02 23:37:09 +02:00
|
|
|
args: Script's arguments,
|
|
|
|
pid: Script's pid
|
2019-03-03 04:08:54 +01:00
|
|
|
}
|
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
Example:
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. code-block:: javascript
|
|
|
|
|
2023-01-06 13:43:09 +01:00
|
|
|
const processes = ns.ps("home");
|
|
|
|
for (const i = 0; i < processes.length; ++i) {
|
|
|
|
ns.tprint(processes[i].filename + ' ' + processes[i].threads);
|
|
|
|
ns.tprint(processes[i].args);
|
|
|
|
ns.tprint(processes[i].pid);
|
2019-03-03 04:08:54 +01:00
|
|
|
}
|