isRunning() Netscript Function¶
-
isRunning
(filename[, hostname=current hostname[, args...]])¶ RAM cost: 0.1 GB
Arguments: - filename (string) – Filename of script to check. case-sensitive.
- hostname (string) – Hostname of target server. Defaults to current server
- args... – Arguments to specify/identify which scripts to search for
Returns: true
if that script with those args is running on that server.Note
Remember that a script is uniquely identified by both its name and its arguments.
Examples:
In this first example below, the function call will return true if there is a script named
foo.script
with no arguments running on thefoodnstuff
server, and false otherwise:isRunning("foo.script", "foodnstuff");
In this second example below, the function call will return true if there is a script named
foo.script
with no arguments running on the current server, and false otherwise:isRunning("foo.script", getHostname());
In this next example below, the function call will return true if there is a script named
foo.script
running with the arguments 1, 5, and “test” (in that order) on thejoesguns
server, and false otherwise:isRunning("foo.script", "joesguns", 1, 5, "test");
-
isRunning
(scriptPid) RAM cost: 0.1 GB
Arguments: - scriptPid (number) – PID of the script to check.
Same as the above version but with pid.
Example:
isRunning(39);