diff --git a/bin/auto-cpufreq b/bin/auto-cpufreq index fc16131..9006960 100755 --- a/bin/auto-cpufreq +++ b/bin/auto-cpufreq @@ -29,7 +29,8 @@ def main(monitor, live, daemon, install, log): footer(79) else: if daemon: - if os.getenv("PKG_MARKER") == "SNAP" and os.getenv("DAEMON") == "ENABLED": + #if os.getenv("PKG_MARKER") == "SNAP" and os.getenv("DAEMON") == "ENABLED": + if os.getenv("PKG_MARKER") == "SNAP": while True: root_check() gov_check() @@ -75,25 +76,21 @@ def main(monitor, live, daemon, install, log): read_log() elif install: if os.getenv('PKG_MARKER') == "SNAP": - os.environ["DAEMON"] = "ENABLED" running_check() root_check() gov_check() - # ToDo: - # implement option to restart snap service? + #os.environ["DAEMON"] = "ENABLED" + s.run("snapctl start --enable auto-cpufreq", shell=True) else: running_check() root_check() gov_check() deploy() - # ToDo: add remove for snap elif remove: if os.getenv('PKG_MARKER') == "SNAP": root_check() - # ToDo: remove if not needed? - #kill_process("auto-cpufreq --daemon") - # ToDo: - # implement option to stop and restart snap service? + #s.run("snapctl stop --disable auto-cpufreq", shell=True) + s.run("snapctl stop --disable auto-cpufreq", shell=True) else: root_check() diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 61b40be..5ad853f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -37,6 +37,6 @@ apps: LC_ALL: C.UTF-8 LANG: C.UTF-8 PKG_MARKER: SNAP - DAEMON: ENABLED + DAEMON: DISABLED daemon: simple \ No newline at end of file diff --git a/source/core.py b/source/core.py index fba7b89..a484c8a 100644 --- a/source/core.py +++ b/source/core.py @@ -401,11 +401,4 @@ def running_check(): print("----") print("\nTo view live log run:\n\tauto-cpufreq --log") footer(79) - sys.exit() - -# kill process func -def kill_process(pstring): - for line in os.popen("ps ef | grep \"" + pstring + "\" | grep -v grep"): - fields = line.split() - pid = fields[0] - os.kill(int(pid), signal.SIGKILL) \ No newline at end of file + sys.exit() \ No newline at end of file