Package: keepserver
Monitor keepalived status, run start.sh if server get MASTER role, and run stop.sh if server get SLAVE role.Installpip install keepstartExample Configapplication:
    daemon: true
    workspace: /opt/ssh-proxy-server
    pidfile: ssh-proxy-server.pid

keepstart:
    nic: lo
    vip: 127.0.0.1
    start: /opt/ssh-proxy-server/start.sh
    stop: /opt/ssh-proxy-server/stop.sh
    is-running: /opt/ssh-proxy-server/is-running.sh
    sleep: 2
    running-report-cycle: 3600
    force-test-cycle: 60

logging:
    version: 1
    disable_existing_loggers: false
    formatters:
        simple:
            format: "%(asctime)-15s\t%(levelname)s\t%(message)s"
    handlers:
        console:
            class: logging.StreamHandler
            level: DEBUG
            formatter: simple
        file:
            class: logging.handlers.TimedRotatingFileHandler
            level: DEBUG
            formatter: simple
            filename: /opt/ssh-proxy-server/server.log
            backupCount: 30
            when: D
            interval: 1
            encoding: utf-8
    loggers:
        keepstart:
            level: INFO
            handlers:
                - file
                - console
            propagate: no
    root:
        level: INFO
        handlers:
            - file
            - consoleConfig to use separated logging.confconfig.yamlapplication:
    daemon: true
    workspace: /opt/ssh-proxy-server
    pidfile: ssh-proxy-server.pid

keepstart:
    nic: lo
    vip: 127.0.0.1
    start: /opt/ssh-proxy-server/start.sh
    stop: /opt/ssh-proxy-server/stop.sh
    is-running: /opt/ssh-proxy-server/is-running.sh
    sleep: 2
    running-report-cycle: 3600
    force-test-cycle: 60

logging: logging.confset logging to the config file in config.yaml, and create logging.conf file.logging.conf[loggers]
keys=root,keepserver,appserver

[handlers]
keys=consoleHandler,fileHandler

[formatters]
keys=simpleFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler,fileHandler

[logger_keepserver]
level=DEBUG
handlers=consoleHandler,fileHandler
qualname=keepserver
propagate=0

[logger_appserver]
level=DEBUG
handlers=consoleHandler,fileHandler
qualname=appserver
propagate=0

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)

[handler_fileHandler]
class=logging.handlers.TimedRotatingFileHandler
level=DEBUG
formatter=simpleFormatter
args=('logFile.log', 'D', 1, 30, 'utf-8')

[formatter_simpleFormatter]
format=%(asctime)s %(levelname)5s %(message)sYou must add logger_xxx which xxx is the module to be actived for logging.Config item descriptionkeepstart.nicWhich nic to be monitored.keepstart.vipWhich vip will be used on the given nic. If vip is set, the server got MASTER role, if vip is not set, the server got SLAVE role.keepstart.start & keepstart.stop & keepstart.is-runningScripts to do start, stop and is-running test. All scripts must NOT blocked.keepstart.sleepHow long time to wait to do role test.keepstart.running-report-cycleHow long time to wait to write alive report to log.keepstart.force-test-cycleHow many time to wait to do a force is-running check(time = sleep * force-test-cycle).Server commandkeepserver -c config.yaml start
keepserver -c config.yaml stop
keepserver -c config.yaml reloadCommand helpzencoreDeMacPro:keepstart zencore$ keepserver --help
Usage: keepserver [OPTIONS] COMMAND [ARGS]...

Options:
-c, --config FILENAME  Config file path, use yaml format. Default to
                        config.yaml.
--help                 Show this message and exit.

Commands:
reload  Reload application server.
start   Start application server.
stop    Stop application server.
zencoreDeMacPro:keepstart zencore$