From 44dc32e40f43041cb0441fcd1f1f9eb485b3c010 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 9 Mar 2005 21:02:54 +0000 Subject: Add is_service_running() --- etc/inc/pfsense-utils.inc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'etc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index e5692b5..7726b49 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -632,4 +632,18 @@ function gather_altq_queue_stats($dont_return_root_queues) { return $queue_stats; } +/* + * is_service_running($service_name): checks to see if a service is running. + * if the service is running returns 1. + */ +function is_service_running($service_name) { + $status = `/bin/ps ax | grep {$service_name}`; + $status_split = split("\n", $service_name); + $counter = 0; + foreach ($status_split as $ss) $counter++ + if($counter > 1) return 1; + return 0; + +} + ?> -- cgit v1.1