summaryrefslogtreecommitdiffstats
path: root/tuned
diff options
context:
space:
mode:
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()