summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 072ba36)
raw | patch | inline | side by side (parent: 072ba36)
author | Sven Trenkel <collectd@semidefinite.de> | |
Wed, 21 Apr 2010 16:26:55 +0000 (18:26 +0200) | ||
committer | Sven Trenkel <collectd@semidefinite.de> | |
Wed, 21 Apr 2010 16:26:55 +0000 (18:26 +0200) |
contrib/python/getsigchld.py | [new file with mode: 0644] | patch | blob |
src/collectd-python.pod | patch | blob | history |
diff --git a/contrib/python/getsigchld.py b/contrib/python/getsigchld.py
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+###############################################################################
+# WARNING! Importing this script will break the exec plugin! #
+###############################################################################
+# Use this if you want to create new processes from your python scripts. #
+# Normally you will get a OSError exception when the new process terminates #
+# because collectd will ignore the SIGCHLD python is waiting for. #
+# This script will restore the default SIGCHLD behavior so python scripts can #
+# create new processes without errors. #
+###############################################################################
+# WARNING! Importing this script will break the exec plugin! #
+###############################################################################
+
+import signal
+import collectd
+
+def init():
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+
+collectd.register_init(init)
index 05a411cc25755ac6373fe149632a222cc8f46148..dd0f1f6800655b84e6a2a4127aa6f4911c785124 100644 (file)
--- a/src/collectd-python.pod
+++ b/src/collectd-python.pod
Depending on your version of python this might or might not result in an
B<OSError> exception which can be ignored.
+If you really need to spawn new processes from python you can register an init
+callback and reset the action for SIGCHLD to the default behavior. Please note
+that this I<will> break the exec plugin. Do not even load the exec plugin if
+you intend to do this!
+
+There is an example script located in B<contrib/python/getsigchld.py> to do
+this. If you import this from I<collectd.conf> SIGCHLD will be handled
+normally and spawning processes from python will work as intended.
+
=back
=item E<lt>B<Module> I<Name>E<gt> block