Commit 8a8842e1 authored by Jonathan Michalon's avatar Jonathan Michalon

Support commandline-passed config file in picomon_watchdog

parent 9894b6af
import subprocess import subprocess
import config import sys
import os
import importlib
from picomon import config
from picomon import mails from picomon import mails
retcode =["python3", ""]) # launch picomon
retcode =["python3", ""] + sys.argv[1:])
# load config file
# (unprotected, will trigger exceptions if problems but real picomon beforehand)
configfile = ""
if "-c" in sys.argv:
configfile = sys.argv[sys.argv.index("-c")+1]
if "--config" in sys.argv:
configfile = sys.argv[sys.argv.index("--config")+1]
filename = os.path.basename(configfile)
base, ext = os.path.splitext(filename)
# send warning
mails.send_email(config.emails.watchdog_subject, mails.send_email(config.emails.watchdog_subject,
"Picomon exited with status %s" % retcode) "Picomon exited with status %s" % retcode)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment