This commit is contained in:
flaskfarm
2022-10-11 16:59:14 +09:00
parent 9aeae36964
commit c6f5dd9175

View File

@@ -117,29 +117,32 @@ class ModuleSetting(PluginModuleBase):
def plugin_load(self): def plugin_load(self):
try: try:
F.logger.info(f"arg_repeat : {F.config['arg_repeat']}") if F.config['run_flask']:
if F.config['arg_repeat'] == 0 or SystemModelSetting.get('system_start_time') == '': F.logger.info(f"arg_repeat : {F.config['arg_repeat']}")
SystemModelSetting.set('system_start_time', datetime.now().strftime('%Y-%m-%d %H:%M:%S')) F.logger.info(f"arg_repeat : {F.config['arg_repeat']}")
SystemModelSetting.set('repeat', str(F.config['arg_repeat']))
username = SystemModelSetting.get('web_id')
passwd = SystemModelSetting.get('web_pw')
F.users[username] = User(username, passwd_hash=passwd)
self.__set_restart_scheduler() if F.config['arg_repeat'] == 0 or SystemModelSetting.get('system_start_time') == '':
self.__set_scheduler_check_scheduler() SystemModelSetting.set('system_start_time', datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
F.get_recent_version() SystemModelSetting.set('repeat', str(F.config['arg_repeat']))
username = SystemModelSetting.get('web_id')
passwd = SystemModelSetting.get('web_pw')
F.users[username] = User(username, passwd_hash=passwd)
notify_yaml_filepath = os.path.join(F.config['path_data'], 'db', 'notify.yaml') self.__set_restart_scheduler()
if os.path.exists(notify_yaml_filepath) == False: self.__set_scheduler_check_scheduler()
import shutil F.get_recent_version()
shutil.copy(
os.path.join(F.config['path_app'], 'files', 'notify.yaml.template'), notify_yaml_filepath = os.path.join(F.config['path_data'], 'db', 'notify.yaml')
notify_yaml_filepath if os.path.exists(notify_yaml_filepath) == False:
) import shutil
if SystemModelSetting.get_bool('restart_notify'): shutil.copy(
from tool import ToolNotify os.path.join(F.config['path_app'], 'files', 'notify.yaml.template'),
msg = f"시스템이 시작되었습니다.\n재시작: {F.config['arg_repeat']}" notify_yaml_filepath
ToolNotify.send_message(msg, message_id='system_start') )
if SystemModelSetting.get_bool('restart_notify'):
from tool import ToolNotify
msg = f"시스템이 시작되었습니다.\n재시작: {F.config['arg_repeat']}"
ToolNotify.send_message(msg, message_id='system_start')
except Exception as e: except Exception as e:
P.logger.error(f'Exception:{str(e)}') P.logger.error(f'Exception:{str(e)}')
P.logger.error(traceback.format_exc()) P.logger.error(traceback.format_exc())