import util.system as system import util.remote as remote from util.log import log import sys kojidatabase_name = "kojidatabase" remote.require_container(kojidatabase_name) remote.wait_if_not_up(kojidatabase_name, 5432) services = ["httpd"] if not "nokojira" in sys.argv: services.append("kojira") def shutdown(*args): for service in reversed(services): log.info("Stopping {0}".format(service)) system.service(service, "stop") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) for service in services: log.info("Starting {0}".format(service)) system.service(service, "start") log.info("Monitoring httpd log") tail.watch("/var/log/httpd/error_log")
import util.cleanup as cleanup import util.tail as tail import util.system as system import util.remote as remote from util.log import log import sys kojidatabase_name = "kojidatabase" remote.require_container(kojidatabase_name) remote.wait_if_not_up(kojidatabase_name, 5432) services = ["httpd"] if not "nokojira" in sys.argv: services.append("kojira") def shutdown(*args): for service in reversed(services): log.info("Stopping {0}".format(service)) system.service(service, "stop") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) for service in services: log.info("Starting {0}".format(service)) system.service(service, "start") log.info("Monitoring httpd log") tail.watch("/var/log/httpd/error_log")
#!/usr/bin/env python2 import util.cleanup as cleanup import util.tail as tail import util.system as system from util.log import log services = ["postgresql"] def shutdown(*args): for service in reversed(services): log.info("Stopping {0}".format(service)) system.service(service, "stop") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) for service in services: log.info("Starting {0}".format(service)) system.service(service, "start") log.info("Monitoring postgresql log") log_files = [] for day in ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]: log_files.append("/var/lib/pgsql/data/pg_log/postgresql-{0}.log".format(day)) tail.watch(log_files)
#!/usr/bin/env python2 import util.cleanup as cleanup import util.tail as tail import util.system as system from util.log import log services = ["postgresql"] def shutdown(*args): for service in reversed(services): log.info("Stopping {0}".format(service)) system.service(service, "stop") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) for service in services: log.info("Starting {0}".format(service)) system.service(service, "start") log.info("Monitoring postgresql log") log_files = [] for day in ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]: log_files.append( "/var/lib/pgsql/data/pg_log/postgresql-{0}.log".format(day)) tail.watch(log_files)