Fix commands server and off.
This commit is contained in:
parent
9490bc08b3
commit
27a8af70ef
3 changed files with 13 additions and 11 deletions
4
Makefile
4
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 = 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_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_contrib = contrib/diskdevstat contrib/netdevstat contrib/scomes contrib/varnetload
|
||||||
FILES_tuningplugins = tuningplugins/cpu.py tuningplugins/disk.py tuningplugins/net.py tuningplugins/__init__.py
|
FILES_tuningplugins = tuningplugins/disk.py tuningplugins/net.py tuningplugins/__init__.py
|
||||||
FILES_monitorplugins = monitorplugins/cpu.py monitorplugins/disk.py monitorplugins/net.py monitorplugins/__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
|
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
|
DOCS = AUTHORS ChangeLog COPYING INSTALL NEWS README
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,12 @@ class Off(Command):
|
||||||
|
|
||||||
|
|
||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
if os.path.exists("/etc/tune.d/*.conf"):
|
os.system("rm -rf /etc/ktune.d/{server,laptop}.conf")
|
||||||
os.remove("/etc/tune.d/*.conf")
|
os.system("rm -rf /etc/ktune.d/{server,laptop}.sh")
|
||||||
if os.path.exists("/etc/tune.d/*.sh"):
|
|
||||||
os.remove("/etc/tune.d/*.sh")
|
|
||||||
if os.path.exists("/etc/sysconfig/ktune.bckp"):
|
if os.path.exists("/etc/sysconfig/ktune.bckp"):
|
||||||
os.system('mv /etc/sysconfig/ktune.bckp /etc/sysconfig/ktune')
|
os.rename("/etc/sysconfig/ktune.bckp", "/etc/sysconfig/ktune")
|
||||||
os.remove("/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 ktune stop')
|
||||||
os.system('service tuned stop')
|
os.system('service tuned stop')
|
||||||
os.system('chkconfig --del ktune')
|
os.system('chkconfig --del ktune')
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,15 @@ class Server(Command):
|
||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
# link config files into directory which is exectued by ktune
|
# link config files into directory which is exectued by ktune
|
||||||
if os.path.exists("/etc/tune-profiles/server/server.conf"):
|
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"):
|
if os.path.exists("/etc/tune-profiles/server/server.sh"):
|
||||||
os.symlink("/etc/tune-profiles/server/server.sh", "/etc/tune.d/server.sh")
|
os.symlink("/etc/tune-profiles/server/server.sh", "/etc/ktune.d/server.sh")
|
||||||
os.system('mv /etc/sysconfig/ktune /etc/sysconfig/ktune.bckp')
|
|
||||||
if os.path.exists("/etc/tune-profiles/server/ktune"):
|
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")
|
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('service ktune start')
|
||||||
os.system('chkconfig --add ktune && chkconfig --level 345 ktune on')
|
os.system('chkconfig --add ktune && chkconfig --level 345 ktune on')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue