summaryrefslogtreecommitdiffstats
path: root/tuned
diff options
context:
space:
mode:
authorPhilip Knirsch <pknirsch@hamburg.stuttgart.redhat.com>2009-02-25 11:45:48 +0100
committerPhilip Knirsch <pknirsch@hamburg.stuttgart.redhat.com>2009-02-25 11:45:48 +0100
commitca552606191920c1f6d02c28b80273d2e9d4349a (patch)
tree33d7eda5f5b7ffe1d842a2c9395ea2a03650d01a /tuned
parent1fa57228447abc46d58bcc377ab373c026ccd008 (diff)
downloadtuned-ca552606191920c1f6d02c28b80273d2e9d4349a.tar.gz
tuned-ca552606191920c1f6d02c28b80273d2e9d4349a.tar.xz
tuned-ca552606191920c1f6d02c28b80273d2e9d4349a.zip
- Added complete cleanup code in case of tuned exiting and/or
getting a SIGTERM to restore default values - Made the disk tuning pluging less nosy if started as non-daemon - Fixed missing self. in the tuned.py config handling
Diffstat (limited to 'tuned')
-rwxr-xr-xtuned8
1 files changed, 7 insertions, 1 deletions
diff --git a/tuned b/tuned
index 126200c..8452947 100755
--- a/tuned
+++ b/tuned
@@ -20,11 +20,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-import sys, os.path, getopt
+import sys, os.path, getopt, atexit, signal
def usage():
print "Usage: tuned [-d|--daemon] [-c conffile|--config=conffile]"
+def handler(signum, frame):
+ sys.exit()
+
def daemonize():
try:
pid = os.fork()
@@ -76,6 +79,9 @@ if __name__ == "__main__":
from tuned import tuned
+ atexit.register(tuned.cleanup)
+ signal.signal(signal.SIGTERM, handler)
+
tuned.init(TUNEDDIR, cfgfile)
tuned.run()
tuned.cleanup()