Mwnci process() Function

Syntax

process()

Description

The process() function returns a hash of the process table that contain the lines equivalent to the system command ps aux.
The process id’s (Pid) are used as the keys of the hash.

Example

include("ps")
Data=process()
foreach Pid in keys(Data) {
    if (Data[Pid]["USER"] == "www-data") {
        println(Data[Pid])
    }
}


{"TTY": "?", "TIME": "0:00", "COMMAND": "/usr/sbin/apache2 -k start", "CPU": 0, "START": "00:31", "MEM": 0, "VSZ": 10136, "STAT": "S", "USER": "www-data", "RSS": 4900}
{"MEM": 0, "VSZ": 2001248, "STAT": "Sl", "USER": "www-data", "TTY": "?", "COMMAND": "/usr/sbin/apache2 -k start", "RSS": 5172, "START": "00:31", "TIME": "0:00", "CPU": 0}
{"STAT": "S", "RSS": 4736, "MEM": 0, "VSZ": 10104, "USER": "www-data", "TTY": "?", "START": "00:31", "TIME": "0:00", "COMMAND": "/usr/sbin/apache2 -k start", "CPU": 0}
{"TTY": "?", "START": "00:31", "TIME": "0:00", "CPU": 0, "VSZ": 2001248, "STAT": "Sl", "USER": "www-data", "COMMAND": "/usr/sbin/apache2 -k start", "MEM": 0, "RSS": 5300}