multiplex conserver across hosts
[invirt/packages/invirt-console.git] / files / usr / sbin / invirt-console-update
diff --git a/files/usr/sbin/invirt-console-update b/files/usr/sbin/invirt-console-update
new file mode 100755 (executable)
index 0000000..d5035e6
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+import sys
+import os
+import subprocess
+
+def main(args):
+  contents = args[2]
+  hostname = os.environ['REMOTE_HOST'].lower()
+  f = file('/etc/conserver/conf.d/'+hostname, 'w')
+  f.write(contents)
+  f.close()
+  p = subprocess.Popen(['/etc/init.d/conserver-server', 'reload'],
+                       stdout=subprocess.PIPE)
+  p.wait()
+  return 0
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))