mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	修复因systemd服务而无法启动或者停止节点的Bug
This commit is contained in:
		@@ -287,6 +287,9 @@ func (this *Queue) StartNode(nodeId int64) error {
 | 
			
		||||
		return errors.New("edge node is not installed correctly, can not find executable file: " + exeFile)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 我们先尝试Systemd启动
 | 
			
		||||
	_, _, _ = installer.client.Exec("systemctl start edge-node")
 | 
			
		||||
 | 
			
		||||
	_, stderr, err := installer.client.Exec(exeFile + " start")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return errors.New("start failed: " + err.Error())
 | 
			
		||||
@@ -388,12 +391,15 @@ func (this *Queue) StopNode(nodeId int64) error {
 | 
			
		||||
		return errors.New("edge node is not installed correctly, can not find executable file: " + exeFile)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 我们先尝试Systemd停止
 | 
			
		||||
	_, _, _ = installer.client.Exec("systemctl stop edge-node")
 | 
			
		||||
 | 
			
		||||
	_, stderr, err := installer.client.Exec(exeFile + " stop")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return errors.New("start failed: " + err.Error())
 | 
			
		||||
		return errors.New("stop failed: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
	if len(stderr) > 0 {
 | 
			
		||||
		return errors.New("start failed: " + stderr)
 | 
			
		||||
		return errors.New("stop failed: " + stderr)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user