Hacked By AnonymousFox

Current Path : /proc/thread-self/root/bin/
Upload File :
Current File : //proc/thread-self/root/bin/clwpos-daemon

#!/opt/cloudlinux/venv/bin/python3 -bb
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2020 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT
#

from __future__ import absolute_import

import argparse
import logging

from clwpos.daemon import WposDaemon
from clwpos.daemon_config import load_config
from clwpos.logsetup import setup_logging, init_wpos_sentry_safely

_DAEMON_LOGFILE_PATH = "/var/log/clwpos/daemon.log"


def daemon_main(_opts):
    daemon = WposDaemon()
    if _opts.action == "start":
        daemon.run()
    if _opts.action == "restart":
        daemon.stop(graceful=False)
        daemon.run()
    elif _opts.action == "stop":
        daemon.stop(_opts.graceful)
    elif _opts.action == "reload":
        daemon.reload()


if __name__ == '__main__':
    parser = argparse.ArgumentParser(prog='wpos-daemon',
                                     add_help=True,
                                     description='Cloudlinux AccelerateWP daemon')
    parser.add_argument('action',
                        help='start|restart|stop|reload the Cloudlinux AccelerateWP daemon',
                        choices=['start', 'restart', 'stop', 'reload'])
    parser.add_argument('--graceful', help='use with the "stop" action to cleanup all processes',
                        action='store_true', default=False)

    opts = parser.parse_args()

    config = load_config()
    setup_logging(
        caller_name=None,
        console_level=logging.getLevelName(config.logging_level),
        file_level=logging.getLevelName(config.logging_level),
        logfile_path=_DAEMON_LOGFILE_PATH
    )
    init_wpos_sentry_safely()

    daemon_main(opts)

Hacked By AnonymousFox1.0, Coded By AnonymousFox