mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +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 {
|
||||
return fmt.Errorf("invalid option %s", param)
|
||||
}
|
||||
processId, err := getRunProcessPid(nodeId)
|
||||
if err != nil {
|
||||
return err
|
||||
for{
|
||||
processId, pErr := getRunProcessPid(nodeId)
|
||||
if pErr != nil {
|
||||
break
|
||||
}
|
||||
|
||||
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))
|
||||
os.Exit(-1)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
timer.StartTimer(10*time.Millisecond, 1000000)
|
||||
//2.记录进程id号
|
||||
log.Info("Start running server.")
|
||||
//2.初始化node
|
||||
writeProcessPid(nodeId)
|
||||
timer.StartTimer(10*time.Millisecond, 1000000)
|
||||
|
||||
//3.初始化node
|
||||
initNode(nodeId)
|
||||
|
||||
//3.运行service
|
||||
//4.运行service
|
||||
service.Start()
|
||||
|
||||
//4.运行集群
|
||||
//5.运行集群
|
||||
cluster.GetCluster().Start()
|
||||
|
||||
//5.记录进程id号
|
||||
writeProcessPid(nodeId)
|
||||
|
||||
|
||||
//6.监听程序退出信号&性能报告
|
||||
bRun := true
|
||||
|
||||
Reference in New Issue
Block a user