Files
Eww_Widgets/widgets/noti/scripts/monitor_logger.py
T
2023-04-24 15:41:27 +05:45

21 lines
549 B
Python
Executable File

#!/usr/bin/env python
import subprocess
import os
def launch_logger():
logger_path = os.path.join("scripts", "logger.py")
try:
# Check if logger.py is already running
subprocess.check_output(["pidof", "-x", "python", logger_path])
print("logger.py is already running")
except subprocess.CalledProcessError:
# logger.py is not running, launch it
subprocess.Popen(["python", logger_path, "init", "&"])
print("logger.py has been launched")
if __name__ == "__main__":
launch_logger()