Mini Shell

Direktori : /usr/share/lve-stats/
Upload File :
Current File : //usr/share/lve-stats/lvestats-server.py

# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
from __future__ import absolute_import

import argparse
import lvestats.lib.lvestats_server
from clcommon.lib.cledition import lve_supported_or_exit


@lve_supported_or_exit
def main():

    parser = argparse.ArgumentParser(prog='lvestats-server',
                                     add_help=True,
                                     description='LveStats2 server daemon')

    parser.add_argument('-p', '--pidfile',
                        help='file path/name to write pid to',
                        dest='pidfile', metavar='PID_FILE')
    parser.add_argument('-n', '--nodaemon',
                        help='do not fork, run in foreground',
                        action='store_true',
                        dest='nodaemon',
                        default=False)
    parser.add_argument('-s', '--singleprocess',
                        help='do not make separate process for running plugins. May halt if plugin halts.',
                        action='store_true',
                        dest='singleprocess',
                        default=False)
    parser.add_argument('-l', '--plugins',
                        help='list of plugin names to invoke, in order of invocation',
                        dest='plugins',
                        nargs='*',
                        default=[],
                        metavar='PLUGIN_CLASS_NAME')
    parser.add_argument('--profile',
                        help='Perform profiling and save data to specified file',
                        dest='profiling_log',
                        metavar='FILE')
    parser.add_argument('--times',
                        type=int,
                        help='Perfrom N times duty cycle only. Default is infinite work',
                        dest='times',
                        metavar='N')
    parser.add_argument('--debug',
                        help='Use logger level DEBUG instead of INFO in "no daemon" mode',
                        action='store_true',
                        dest='debug_mode',
                        default=False)
    parser.add_argument('action',
                        help='start|stop|restart the server',
                        choices=['start', 'stop', 'restart'])

    opts = parser.parse_args()
    lvestats.lib.lvestats_server.main(opts)


if __name__ == '__main__':
    main()

Zerion Mini Shell 1.0