Permalink
Browse files

runit plugin

  • Loading branch information...
1 parent a2923ee commit 3e4439fd52a6b0c1f2c9200fd604d184edd51d17 Scott Smith committed Jul 27, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 share/plugins/runit.py
View
19 share/plugins/runit.py
@@ -0,0 +1,19 @@
+import glob
+import os
+from subprocess import Popen, PIPE
+from porkchop.plugin import PorkchopPlugin
+
+class RunitPlugin(PorkchopPlugin):
+ def service_status(self, service):
+ return Popen('/usr/bin/sv status %s' % service, stdout=PIPE,
+ shell=True).communicate()[0].strip()
+
+ def get_data(self):
+ d1 = {}
+
+ service_dirs = glob.glob('/etc/sv/*')
+ for dir in service_dirs:
+ service = os.path.basename(dir)
+ d1[service] = self.service_status(service)
+
+ return d1

0 comments on commit 3e4439f

Please sign in to comment.