-
Notifications
You must be signed in to change notification settings - Fork 167
/
Copy pathstartup.py
36 lines (29 loc) · 962 Bytes
/
startup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: shenshuo
Date : 2023/2/25
Desc : 启动脚本
"""
import fire
from tornado.options import define
from websdk2.program import MainProgram
from settings import settings as app_settings
from cmdb.applications import Application as CmdbApp
from libs.registration import Registration
define("service", default='cmdb', help="start service flag", type=str)
class MyProgram(MainProgram):
def __init__(self, service='cmdb', progressid=''):
self.__app = None
settings = app_settings
if service == 'cmdb':
self.__app = CmdbApp(**settings)
elif service in ['init']:
self.__app = Registration(**settings)
super(MyProgram, self).__init__(progressid)
self.__app.start_server()
if __name__ == '__main__':
fire.Fire(MyProgram)
# python3 startup.py --service=init
# python3 db_sync.py
# python3 startup.py --service=cmdb --port=8899