mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
优化进程启动
This commit is contained in:
10
node/node.go
10
node/node.go
@@ -19,6 +19,7 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
"github.com/shirou/gopsutil/process"
|
||||
)
|
||||
|
||||
var sig chan os.Signal
|
||||
@@ -236,6 +237,7 @@ func retireNode(args interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
RetireProcess(processId)
|
||||
return nil
|
||||
}
|
||||
@@ -287,6 +289,14 @@ func startNode(args interface{}) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid option %s", param)
|
||||
}
|
||||
processId, err := getRunProcessPid(nodeId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ok,_ := process.PidExists(int32(processId))
|
||||
if ok == true {
|
||||
return fmt.Errorf("repeat runs are not allowed,node is %d,processid is %d",nodeId,processId)
|
||||
}
|
||||
|
||||
timer.StartTimer(10*time.Millisecond, 1000000)
|
||||
log.Info("Start running server.")
|
||||
|
||||
Reference in New Issue
Block a user