From b19a704aeef5da4eecba91c9680c00cf80b7d639 Mon Sep 17 00:00:00 2001
From: naiba
Date: Sun, 24 Jan 2021 21:17:37 +0800
Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20dayNight=E4=B8=BB=E9=A2=98?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=20+=20=E4=B8=80=E4=BA=9B=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmd/dashboard/controller/member_page.go | 1 -
cmd/playground/example.sh | 9 +++++++++
cmd/playground/main.go | 15 ++++++++-------
pkg/mygin/mygin.go | 1 +
resource/template/component/cron.html | 4 ++--
resource/template/theme-daynight/home.html | 12 ++++--------
resource/template/theme-daynight/service.html | 2 +-
service/dao/dao.go | 2 +-
8 files changed, 26 insertions(+), 20 deletions(-)
create mode 100755 cmd/playground/example.sh
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
+ 或者使用绝对路径执行,示例 备份脚本。