diff --git a/cmd/dashboard/controller/member_page.go b/cmd/dashboard/controller/member_page.go index 66ab61b..be09547 100644 --- a/cmd/dashboard/controller/member_page.go +++ b/cmd/dashboard/controller/member_page.go @@ -71,6 +71,5 @@ func (mp *memberPage) notification(c *gin.Context) { func (mp *memberPage) setting(c *gin.Context) { c.HTML(http.StatusOK, "dashboard/setting", mygin.CommonEnvironment(c, gin.H{ "Title": "系统设置", - "Conf": dao.Conf, })) } diff --git a/cmd/playground/example.sh b/cmd/playground/example.sh new file mode 100755 index 0000000..a6a5e09 --- /dev/null +++ b/cmd/playground/example.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -x + +ME=`whoami` + +ping example.com -c20 && \ + echo "==== $ME ====" && \ + ping example.net -c20 && \ + echo "==== done! ====" \ No newline at end of file diff --git a/cmd/playground/main.go b/cmd/playground/main.go index ceac57a..93402dc 100644 --- a/cmd/playground/main.go +++ b/cmd/playground/main.go @@ -6,6 +6,7 @@ import ( "log" "net" "net/http" + "os" "os/exec" "time" @@ -16,8 +17,9 @@ import ( func main() { // icmp() // tcpping() - httpWithSSLInfo() + // httpWithSSLInfo() // diskinfo() + cmdExec() } func tcpping() { @@ -71,13 +73,12 @@ func icmp() { } func cmdExec() { - cmd := exec.Command("ping", "example.com", "-c2") + execFrom, err := os.Getwd() + if err != nil { + panic(err) + } + cmd := exec.Command(execFrom + "/cmd/playground/example.sh") output, err := cmd.Output() log.Println("output:", string(output)) log.Println("err:", err) - - cmd = exec.Command("ping", "example", "-c2") - output, err = cmd.Output() - log.Println("output:", string(output)) - log.Println("err:", err) } diff --git a/pkg/mygin/mygin.go b/pkg/mygin/mygin.go index 81caed1..9199063 100644 --- a/pkg/mygin/mygin.go +++ b/pkg/mygin/mygin.go @@ -21,6 +21,7 @@ var adminPage = map[string]bool{ func CommonEnvironment(c *gin.Context, data map[string]interface{}) gin.H { data["MatchedPath"] = c.MustGet("MatchedPath") data["Version"] = dao.Version + data["Conf"] = dao.Conf // 是否是管理页面 data["IsAdminPage"] = adminPage[data["MatchedPath"].(string)] // 站点标题 diff --git a/resource/template/component/cron.html b/resource/template/component/cron.html index 7e2347b..efbcc7f 100644 --- a/resource/template/component/cron.html +++ b/resource/template/component/cron.html @@ -37,8 +37,8 @@ 计划的格式为:* * * * * 分 时 天 月 星期,详情见 计划表达式格式
- 命令:Shell 命令,就像写脚本一样就可以,如果遇到 xxx 命令找不到,可能是 PATH 环境变量的问题,source ~/.bashrc - 或者使用绝对路径执行。 + 命令:Shell 命令,就像写脚本一样就可以,如果遇到 xxx 命令找不到,可能是 PATH 环境变量的问题,在脚本顶部加一个 source ~/.bashrc + 或者使用绝对路径执行,示例 备份脚本

diff --git a/resource/template/theme-daynight/home.html b/resource/template/theme-daynight/home.html index d967063..615821b 100644 --- a/resource/template/theme-daynight/home.html +++ b/resource/template/theme-daynight/home.html @@ -20,7 +20,7 @@ diff --git a/resource/template/theme-daynight/service.html b/resource/template/theme-daynight/service.html index 69cbfa5..159ba4d 100644 --- a/resource/template/theme-daynight/service.html +++ b/resource/template/theme-daynight/service.html @@ -20,7 +20,7 @@