tuned-adm list
This commit is contained in:
parent
0faaa74df3
commit
83a7845f93
1 changed files with 18 additions and 1 deletions
19
tuned-adm.py
19
tuned-adm.py
|
|
@ -40,6 +40,9 @@ commands:
|
|||
profile <profile-name> switch to given profile
|
||||
"""
|
||||
|
||||
def listdir_joined(path):
|
||||
return [os.path.join(path, entry) for entry in os.listdir(path)]
|
||||
|
||||
class Tuned_adm:
|
||||
|
||||
def error(self, msg, exit_code = 1):
|
||||
|
|
@ -52,7 +55,7 @@ class Tuned_adm:
|
|||
|
||||
def run(self, args):
|
||||
if args[0] == "list":
|
||||
#self.list()
|
||||
self.show_profiles()
|
||||
pass
|
||||
elif args[0] == "active":
|
||||
#self.active()
|
||||
|
|
@ -71,6 +74,20 @@ class Tuned_adm:
|
|||
else:
|
||||
self.error("Nonexistent argument '%s'." % args[0])
|
||||
|
||||
def show_profiles(self):
|
||||
profiles = []
|
||||
try:
|
||||
profiles += listdir_joined("/usr/lib/tuned")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
profiles += listdir_joined("/etc/tuned")
|
||||
except:
|
||||
pass
|
||||
for profile in profiles:
|
||||
if os.path.exists(os.path.join(profile, "tuned.cfg")):
|
||||
print "-", os.path.basename(profile)
|
||||
|
||||
def set_active_profile(self, profile):
|
||||
pid = 0
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue