|
@@ -48,6 +48,17 @@ func init() {
|
|
|
commonConfig.InitWebsocketConfig()
|
|
|
}
|
|
|
|
|
|
+func initRenew() {
|
|
|
+ c_log.GlobalLogger.Info("启动定时器 - 开始。")
|
|
|
+ if renewTimer != nil {
|
|
|
+ renewTimer.Stop()
|
|
|
+ }
|
|
|
+ renewedFlag = true
|
|
|
+ renewTimer = time.AfterFunc(time.Duration(RenewDur)*time.Minute, func() {
|
|
|
+ renewedFlag = false
|
|
|
+ })
|
|
|
+ c_log.GlobalLogger.Infof("定时时间【%v】分钟 - 成功。", RenewDur)
|
|
|
+}
|
|
|
func renew() {
|
|
|
for {
|
|
|
time.Sleep(time.Duration(renewTurnLength) * time.Second)
|
|
@@ -80,6 +91,7 @@ func startMasterNode() {
|
|
|
c_log.GlobalLogger.Info("启动任务,本地执行启动命令:【path】=", commonConfig.LocalConfig.RestartCmd.Dir, "【cmd】=", commonConfig.LocalConfig.RestartCmd.Name, commonConfig.LocalConfig.RestartCmd.Args)
|
|
|
|
|
|
launchedFlag = true
|
|
|
+ initRenew()
|
|
|
c_log.GlobalLogger.Info("数采程序启动 - 成功。")
|
|
|
}
|
|
|
|
|
@@ -162,5 +174,4 @@ func main() {
|
|
|
c_log.GlobalLogger.Error("未知的设备运行状态。【status】=", localStatus)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|