summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2012-07-26 10:30:59 +0200
committerRadek Novacek <rnovacek@redhat.com>2012-07-26 10:30:59 +0200
commit41de23d0e975fa0078d17a4c71e9e61426444d7d (patch)
tree024e8a2909843e9f92f15f0c3636aef94068f29e /src
parentb4cafb696bf10d46c4b26d4b4a1da15e5292eb9f (diff)
downloadopenlmi-providers-41de23d0e975fa0078d17a4c71e9e61426444d7d.tar.gz
openlmi-providers-41de23d0e975fa0078d17a4c71e9e61426444d7d.tar.xz
openlmi-providers-41de23d0e975fa0078d17a4c71e9e61426444d7d.zip
service: better handling of services without Main PID (like iptables)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/service/util/serviceutil.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/service/util/serviceutil.sh b/src/service/util/serviceutil.sh
index c4d9efd..d8c65fd 100755
--- a/src/service/util/serviceutil.sh
+++ b/src/service/util/serviceutil.sh
@@ -43,7 +43,12 @@ then
echo "stopped" # TODO - should be failed and propagated to the state property
else
pid=`echo "$output" | sed -n -e 's/^[ \t]\+Main PID:[ \t]\+\([0-9]\+\).*/\1/p'`
- echo "$pid $2"
+ if [ "$pid" == "" ]; then
+ # Some service don't have Main PID (e.g. iptables), report as PID 1
+ echo "1 $2"
+ else
+ echo "$pid $2"
+ fi
fi
;;
*)