commit 3a84b4206623bcbe5644c648af50bb7086bac133
Author: Radek Novacek <rnovacek(a)redhat.com>
Date: Mon Sep 5 12:27:55 2011 +0200
Create pidfile when starting in background mode
virt-who.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/virt-who.py b/virt-who.py
index 949fa6c..86c6ddd 100644
--- a/virt-who.py
+++ b/virt-who.py
@@ -70,6 +70,14 @@ if __name__ == '__main__':
# Parent process
sys.exit(0)
+ # Write pid to pidfile
+ try:
+ f = open("/var/run/virt-who.pid", "w")
+ f.write("%d" % os.getpid())
+ f.close()
+ except Exception, e:
+ logger.error("Unable to create pid file: %s", str(e))
+
virEventLoopPureStart()
try:
Show replies by date