new location for daemon logs on snap

This commit is contained in:
Adnan Hodzic 2020-02-12 15:22:43 +01:00
parent 75b15ff9b9
commit d48587ce9e
2 changed files with 5 additions and 3 deletions

View File

@ -36,7 +36,7 @@ apps:
PKG_MARKER: SNAP
service:
command: bin/auto-cpufreq --daemon 2>&1 | tee -a /var/log/auto-cpufreq.log
command: bin/auto-cpufreq --daemon 2>&1 | tee -a $SNAP_DATA/auto-cpufreq.log
plugs:
- cpu-control
- system-observe

View File

@ -40,6 +40,7 @@ bat_state = power.PowerManagement().get_providing_power_source_type()
# auto-cpufreq log file
auto_cpufreq_log_file = "/var/log/auto-cpufreq.log"
auto_cpufreq_log_file_snap = "/var/snap/auto-cpufreq/current/auto-cpufreq.log"
# daemon check
dcheck = s.getoutput("snapctl get daemon")
@ -406,8 +407,9 @@ def delete_file(file):
# read log func
def read_log():
if os.path.isfile(auto_cpufreq_log_file):
# read /var/log/auto-cpufreq.log
if os.getenv("PKG_MARKER") == "SNAP":
s.call(["tail", "-n 50", "-f", auto_cpufreq_log_file_snap])
elif os.path.isfile(auto_cpufreq_log_file):
s.call(["tail", "-n 50", "-f", auto_cpufreq_log_file])
else:
print("\n" + "-" * 30 + " auto-cpufreq log " + "-" * 31 + "\n")