From edd618c5436887ff11be5da5de932c3e65750a7a Mon Sep 17 00:00:00 2001 From: Masoko Date: Wed, 26 Mar 2025 21:19:10 +0200 Subject: [PATCH] Scheduling (#206) * display scheduling method in -d output --- src/rpi-cpu2mqtt.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/rpi-cpu2mqtt.py b/src/rpi-cpu2mqtt.py index ac72c36..928ffb8 100644 --- a/src/rpi-cpu2mqtt.py +++ b/src/rpi-cpu2mqtt.py @@ -370,7 +370,7 @@ def print_measured_values(monitored_values): output += " Service Sleep Time: {} seconds\n".format(config.service_sleep_time) if config.update: output += " Update Check Interval: {} seconds\n".format(config.update_check_interval) - # Add dynamic measured values with units + # Add dynamic measured values with units measured_values = { get_translation("cpu_load"): ("cpu_load", "%"), get_translation("cpu_temperature"): ("cpu_temp", "°C"), @@ -393,12 +393,18 @@ def print_measured_values(monitored_values): if key in monitored_values: output += f" {label}: {monitored_values[key]} {unit}\n" - drive_temps = check_all_drive_temps() - if len(drive_temps) > 0: - for device, temp in drive_temps.items(): - output += f" {device.capitalize()} Temp: {temp:.2f}°C\n" + if config.drive_temps: + drive_temps = check_all_drive_temps() + if len(drive_temps) > 0: + for device, temp in drive_temps.items(): + output += f" {device.capitalize()} Temp: {temp:.2f}°C\n" output += "\n:: Scheduling\n " + if check_service_file_exists(): + output += " Running as Service\n" + elif check_crontab_entry(): + output += " Running as Cron Job\n" + if check_service_file_exists(): output += " Running as Service\n" elif check_crontab_entry():