From 27a8af70efd6f78838ec2f9ded11062fe6d287d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Tue, 28 Jul 2009 13:10:55 +0200 Subject: [PATCH] Fix commands server and off. --- Makefile | 4 ++-- commands/cmd_off_mode.py | 11 +++++------ commands/cmd_server_mode.py | 9 ++++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 78e8a9a..af359f1 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ DIRS = doc contrib tuningplugins monitorplugins commands FILES = tuned tuned.spec Makefile tuned.py tuned.initscript tuned.conf tuned-adm FILES_doc = doc/DESIGN.txt doc/README.utils doc/TIPS.txt doc/tuned.8 doc/tuned.conf.5 doc/README.scomes FILES_contrib = contrib/diskdevstat contrib/netdevstat contrib/scomes contrib/varnetload -FILES_tuningplugins = tuningplugins/cpu.py tuningplugins/disk.py tuningplugins/net.py tuningplugins/__init__.py -FILES_monitorplugins = monitorplugins/cpu.py monitorplugins/disk.py monitorplugins/net.py monitorplugins/__init__.py +FILES_tuningplugins = tuningplugins/disk.py tuningplugins/net.py tuningplugins/__init__.py +FILES_monitorplugins = monitorplugins/disk.py monitorplugins/net.py monitorplugins/__init__.py FILES_commands = commands/cmd_default_mode.py commands/cmd_server_mode.py commands/cmd_off_mode.py commands/__init__.py DOCS = AUTHORS ChangeLog COPYING INSTALL NEWS README diff --git a/commands/cmd_off_mode.py b/commands/cmd_off_mode.py index d335752..fcb16a8 100644 --- a/commands/cmd_off_mode.py +++ b/commands/cmd_off_mode.py @@ -21,13 +21,12 @@ class Off(Command): def run(self, *args, **kwargs): - if os.path.exists("/etc/tune.d/*.conf"): - os.remove("/etc/tune.d/*.conf") - if os.path.exists("/etc/tune.d/*.sh"): - os.remove("/etc/tune.d/*.sh") + os.system("rm -rf /etc/ktune.d/{server,laptop}.conf") + os.system("rm -rf /etc/ktune.d/{server,laptop}.sh") if os.path.exists("/etc/sysconfig/ktune.bckp"): - os.system('mv /etc/sysconfig/ktune.bckp /etc/sysconfig/ktune') - os.remove("/etc/sysconfig/ktune") + os.rename("/etc/sysconfig/ktune.bckp", "/etc/sysconfig/ktune") + if os.path.exists("/etc/tuned.conf.bckp") and os.path.exists("/etc/tuned.conf"): + os.rename("/etc/tuned.conf.bckp", "/etc/tuned.conf") os.system('service ktune stop') os.system('service tuned stop') os.system('chkconfig --del ktune') diff --git a/commands/cmd_server_mode.py b/commands/cmd_server_mode.py index 4d250a7..7a496ae 100644 --- a/commands/cmd_server_mode.py +++ b/commands/cmd_server_mode.py @@ -24,12 +24,15 @@ class Server(Command): def run(self, *args, **kwargs): # link config files into directory which is exectued by ktune if os.path.exists("/etc/tune-profiles/server/server.conf"): - os.symlink("/etc/tune-profiles/server/server.conf", "/etc/tune.d/server.conf") + os.symlink("/etc/tune-profiles/server/server.conf", "/etc/ktune.d/server.conf") if os.path.exists("/etc/tune-profiles/server/server.sh"): - os.symlink("/etc/tune-profiles/server/server.sh", "/etc/tune.d/server.sh") - os.system('mv /etc/sysconfig/ktune /etc/sysconfig/ktune.bckp') + os.symlink("/etc/tune-profiles/server/server.sh", "/etc/ktune.d/server.sh") if os.path.exists("/etc/tune-profiles/server/ktune"): + os.system('mv /etc/sysconfig/ktune /etc/sysconfig/ktune.bckp') os.symlink("/etc/tune-profiles/server/ktune", "/etc/sysconfig/ktune") + if os.path.exists("/etc/tune-profiles/server/tuned.conf"): + os.system("mv /etc/tuned.conf /etc/tuned.conf.bckp") + os.symlink("/etc/tune-profiles/server/tuned.conf", "/etc/tuned.conf") os.system('service ktune start') os.system('chkconfig --add ktune && chkconfig --level 345 ktune on')