summaryrefslogtreecommitdiffstats
path: root/etc/inc/service-utils.inc
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-06-24 00:33:07 +0000
committerColin Smith <colin@pfsense.org>2005-06-24 00:33:07 +0000
commitfbeb6d02c09a7fc32d80de7399b3f7be7cb8cc6a (patch)
tree25f5abfe36233c941813761f12ac52069e4b8a61 /etc/inc/service-utils.inc
parent0c8de638040865a215545766aad8c48bd2ebc46a (diff)
downloadpfsense-fbeb6d02c09a7fc32d80de7399b3f7be7cb8cc6a.zip
pfsense-fbeb6d02c09a7fc32d80de7399b3f7be7cb8cc6a.tar.gz
Move the actual ps component of is_service_running into is_process_running.
Diffstat (limited to 'etc/inc/service-utils.inc')
-rw-r--r--etc/inc/service-utils.inc25
1 files changed, 17 insertions, 8 deletions
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc
index 918d89f..602eee6 100644
--- a/etc/inc/service-utils.inc
+++ b/etc/inc/service-utils.inc
@@ -123,20 +123,29 @@ function restart_service($name) {
}
}
-function is_service_running($service, $ps = "") {
- global $config;
+function is_process_running($process, $ps = "") {
if(!$ps) {
- exec("/bin/ps ax | awk '{ print $5 }'", $psout);
- array_shift($psout);
- foreach($psout as $line) {
- $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line)))));
- }
+ exec("/bin/ps ax | awk '{ print $5 }'", $psout);
+ array_shift($psout);
+ foreach($psout as $line) {
+ $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line)))));
+ }
+ }
+ if(in_array($process, $ps)) {
+ return true;
+ } else {
+ return false;
}
+ return false;
+}
+
+function is_service_running($service, $ps = "") {
+ global $config;
if($config['installedpackages']['service']) {
foreach($config['installedpackages']['service'] as $aservice) {
if($service == $aservice['name']) {
if(!$aservice['executable']) return false;
- if(in_array($aservice['executable'], $ps)) {
+ if(is_process_running($aservice['executable'], $ps)) {
return true;
} else {
return false;
OpenPOWER on IntegriCloud