代码拉取完成,页面将自动刷新
package glbm
import (
"fmt"
"strings"
"gitee.com/liumou_site/gf"
)
func (api *ApiService) Start() {
api.sudo.RunSudo("systemctl start ", api.Name)
api.Err = api.sudo.Err
}
func (api *ApiService) ReStart() {
api.sudo.RunSudo("systemctl restart", api.Name)
api.Err = api.sudo.Err
}
func (api *ApiService) Stop() {
api.sudo.RunSudo("systemctl stop", api.Name)
api.Err = api.sudo.Err
}
func (api *ApiService) ReLoad() *ApiService {
api.sudo.RunSudo("systemctl reload", api.Name)
api.Err = api.sudo.Err
return api
}
func (api *ApiService) Enable() *ApiService {
api.sudo.RunSudo("systemctl enable", api.Name)
api.Err = api.sudo.Err
return api
}
func (api *ApiService) Disable() *ApiService {
api.sudo.RunSudo("systemctl disable", api.Name)
api.Err = api.sudo.Err
return api
}
func (api *ApiService) ReLoadDaemon() *ApiService {
api.sudo.RunSudo("systemctl reload-daemon")
api.Err = api.sudo.Err
return api
}
func (api *ApiService) Exists() bool {
api.sudo.RunScriptSudo("systemctl -all| awk '{print $1}'")
r := gf.NewReadFile("demo")
r.Text = api.sudo.Strings
services := strings.Split(r.Text, "\n")
fmt.Println(services)
for _, s := range services {
if strings.Contains(s, api.Name) {
return true
}
}
return false
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。