mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-15 16:34:44 +08:00
优化重复启动验证
This commit is contained in:
23
node/node.go
23
node/node.go
@@ -289,9 +289,10 @@ func startNode(args interface{}) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid option %s", param)
|
return fmt.Errorf("invalid option %s", param)
|
||||||
}
|
}
|
||||||
processId, err := getRunProcessPid(nodeId)
|
for{
|
||||||
if err != nil {
|
processId, pErr := getRunProcessPid(nodeId)
|
||||||
return err
|
if pErr != nil {
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
name, cErr := sysprocess.GetProcessNameByPID(int32(processId))
|
name, cErr := sysprocess.GetProcessNameByPID(int32(processId))
|
||||||
@@ -307,20 +308,24 @@ func startNode(args interface{}) error {
|
|||||||
log.SInfo(fmt.Sprintf("repeat runs are not allowed,node is %d,processid is %d",nodeId,processId))
|
log.SInfo(fmt.Sprintf("repeat runs are not allowed,node is %d,processid is %d",nodeId,processId))
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
timer.StartTimer(10*time.Millisecond, 1000000)
|
//2.记录进程id号
|
||||||
log.Info("Start running server.")
|
log.Info("Start running server.")
|
||||||
//2.初始化node
|
writeProcessPid(nodeId)
|
||||||
|
timer.StartTimer(10*time.Millisecond, 1000000)
|
||||||
|
|
||||||
|
//3.初始化node
|
||||||
initNode(nodeId)
|
initNode(nodeId)
|
||||||
|
|
||||||
//3.运行service
|
//4.运行service
|
||||||
service.Start()
|
service.Start()
|
||||||
|
|
||||||
//4.运行集群
|
//5.运行集群
|
||||||
cluster.GetCluster().Start()
|
cluster.GetCluster().Start()
|
||||||
|
|
||||||
//5.记录进程id号
|
|
||||||
writeProcessPid(nodeId)
|
|
||||||
|
|
||||||
//6.监听程序退出信号&性能报告
|
//6.监听程序退出信号&性能报告
|
||||||
bRun := true
|
bRun := true
|
||||||
|
|||||||
Reference in New Issue
Block a user