[ Agent ] [ Executor ] - add systemc shutdown service
This commit is contained in:
@@ -87,6 +87,46 @@ func BasicPrettyPrint(resultOk bool, resultLog []string) {
|
||||
}
|
||||
}
|
||||
|
||||
func BasicSystemdShutdown(serviceName string) (ok bool, resultLog []string) {
|
||||
|
||||
if !strings.HasSuffix(serviceName, ".service") {
|
||||
serviceName = serviceName + ".service"
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
execute := PureResultSingleExecute(
|
||||
[]string{
|
||||
"systemctl",
|
||||
"status",
|
||||
"-q",
|
||||
serviceName,
|
||||
})
|
||||
if !execute {
|
||||
return true, []string{
|
||||
serviceName,
|
||||
"该服务器不存在!",
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭
|
||||
var shutDownCommand = [][]string{
|
||||
{
|
||||
"systemctl",
|
||||
"stop",
|
||||
serviceName,
|
||||
},
|
||||
{
|
||||
"systemctl",
|
||||
"disable",
|
||||
serviceName,
|
||||
},
|
||||
}
|
||||
|
||||
resultOK := PureResultSingleExecuteBatch(shutDownCommand)
|
||||
|
||||
return resultOK, resultLog
|
||||
}
|
||||
|
||||
func BasicTransPipelineCommand(pipelineString string) (pipelineCommand [][]string) {
|
||||
|
||||
var pipelineCommandC [][]string
|
||||
|
||||
Reference in New Issue
Block a user