{"id":1125,"date":"2025-05-18T07:40:57","date_gmt":"2025-05-18T06:40:57","guid":{"rendered":"https:\/\/monkey.ploogie.co.uk\/?page_id=1125"},"modified":"2025-05-18T07:40:57","modified_gmt":"2025-05-18T06:40:57","slug":"mwnci-process-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-process-function\/","title":{"rendered":"Mwnci process() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>process<strong>()<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>process()<\/i> function returns a hash  of the process table that contain the lines equivalent to the system command <em>ps aux<\/em>.<br \/>\nThe process id&#8217;s (Pid) are used as the keys of the hash.<\/p>\n<h2>Example<\/h2>\n<pre>include(\"ps\")\r\nData=process()\r\nforeach Pid in keys(Data) {\r\n    if (Data[Pid][\"USER\"] == \"www-data\") {\r\n        println(Data[Pid])\r\n    }\r\n}\r\n\r\n\r\n{\"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}\r\n{\"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}\r\n{\"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}\r\n{\"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}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s (Pid) are used as the keys of the hash. Example include(&#8220;ps&#8221;) Data=process() foreach Pid in keys(Data) { if (Data[Pid][&#8220;USER&#8221;] == &#8220;www-data&#8221;) { println(Data[Pid]) } } {&#8220;TTY&#8221;: &#8220;?&#8221;, &#8220;TIME&#8221;: &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-process-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci process() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1125","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1125"}],"version-history":[{"count":1,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1125\/revisions"}],"predecessor-version":[{"id":1126,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1125\/revisions\/1126"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}