summaryrefslogtreecommitdiffstats
path: root/scripts/cobblerd
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-19 15:24:08 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-19 15:24:08 -0400
commit8a46265453503a5dfe04bf10d3019368fb032cf5 (patch)
tree1f965e2948079ae60d3b56c6edaef8d6b59d9119 /scripts/cobblerd
parentc9da67b5170b473895ce83feba2aa328cf5ec9f8 (diff)
downloadthird_party-cobbler-8a46265453503a5dfe04bf10d3019368fb032cf5.tar.gz
third_party-cobbler-8a46265453503a5dfe04bf10d3019368fb032cf5.tar.xz
third_party-cobbler-8a46265453503a5dfe04bf10d3019368fb032cf5.zip
Changes cobbler_syslogd to cobblerd, and this new daemon now offers koan
info over XMLRPC, allowing koan to stop needing to grok YAML. Older versions of koan will remain compatible over standard http://.
Diffstat (limited to 'scripts/cobblerd')
-rwxr-xr-xscripts/cobblerd52
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/cobblerd b/scripts/cobblerd
new file mode 100755
index 0000000..409f738
--- /dev/null
+++ b/scripts/cobblerd
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+"""
+Wrapper for cobbler's remote syslog watching daemon.
+
+Copyright 2006, Red Hat, Inc
+Michael DeHaan <mdehaan@redhat.com>
+
+This software may be freely redistributed under the terms of the GNU
+general public license.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+import sys
+import os
+import cobbler.cobblerd as app
+
+if __name__ == "__main__":
+
+ #############################################
+ # daemonizing code: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012
+ try:
+ pid = os.fork()
+ if pid > 0:
+ # exit first parent
+ sys.exit(0)
+ except OSError, e:
+ print >>sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror)
+ sys.exit(1)
+
+ # decouple from parent environment
+ os.chdir("/")
+ os.setsid()
+ os.umask(0)
+
+ # do second fork
+ try:
+ pid = os.fork()
+ if pid > 0:
+ # print "Daemon PID %d" % pid
+ sys.exit(0)
+ except OSError, e:
+ print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror)
+ sys.exit(1)
+
+ #################
+
+ app.main()
+