{"id":4724,"date":"2019-11-13T18:39:58","date_gmt":"2019-11-13T17:39:58","guid":{"rendered":"https:\/\/pandorafms.com\/library\/?p=4724"},"modified":"2020-10-28T16:03:41","modified_gmt":"2020-10-28T15:03:41","slug":"status-of-any-linux-service","status":"publish","type":"post","link":"https:\/\/pandorafms.com\/library\/status-of-any-linux-service\/","title":{"rendered":"Status of any Linux service"},"content":{"rendered":"<h2>Status of any Linux service<\/h2>\n<p>This simple module checks if specified service exists and is active.<\/p>\n<p>It returns strings based on presence in the system and service activity.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Apache2 example<\/strong><\/p>\n<pre>module_begin\r\nmodule_name apache2_Status\r\nmodule_type generic_data_string\r\nmodule_exec (if test $(systemctl list-unit-files | grep apache2 | wc -l) -ne 0 ; then systemctl is-active --quiet apache2 &amp;&amp; echo active || echo inactive; else echo not installed; fi)\r\nmodule_str_critical inactive\r\nmodule_group Application\r\nmodule_end<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>ANY SERVICE<\/strong><\/p>\n<pre>module_begin\r\nmodule_name (service_name)_Status\r\nmodule_type generic_data_string\r\nmodule_exec (if test $(systemctl list-unit-files | grep <em>(service_name)<\/em> | wc -l) -ne 0 ; then systemctl is-active --quiet <em>(service_name)<\/em> &amp;&amp; echo active || echo inactive; else echo not installed; fi)\r\nmodule_str_critical inactive\r\nmodule_group Application\r\nmodule_end<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Status of any Linux service This simple module checks if specified service exists and is active. It returns strings based on presence in the system and service activity. &nbsp; Apache2 example module_begin module_name apache2_Status module_type generic_data_string module_exec (if test $(systemctl list-unit-files | grep apache2 | wc -l) -ne 0 ; then systemctl is-active &#8211;quiet apache2 [&hellip;]<\/p>\n","protected":false},"author":1009,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts\/4724"}],"collection":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/users\/1009"}],"replies":[{"embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/comments?post=4724"}],"version-history":[{"count":0,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts\/4724\/revisions"}],"wp:attachment":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/media?parent=4724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/categories?post=4724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/tags?post=4724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}