From 7c3f6a58d4f039cc76570e060560591681cb692e Mon Sep 17 00:00:00 2001 From: ouqiang Date: Mon, 8 May 2017 14:07:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 2 +- cmd/web.go | 5 ++++- service/task.go | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4b16b9c..6474b59 100644 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ # 构建应用, 生成压缩包 gocron.zip或gocron.tar.gz # ./build.sh -p windows -a amd64 # 参数含义 -# -p 指定平台(widows|linux|darwin) +# -p 指定平台(windows|linux|darwin) # -a 指定体系架构(amd64|386), 默认amd64 diff --git a/cmd/web.go b/cmd/web.go index 5935f0d..8d8a6aa 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -129,7 +129,10 @@ func shutdown() { // 停止所有任务调度 serviceTask.StopAll() taskNumInRunning := service.TaskNum.Num() - logger.Infof("正在运行的任务有%d个, 等待所有任务执行完成后退出", taskNumInRunning) + logger.Infof("正在运行的任务有%d个", taskNumInRunning) + if taskNumInRunning > 0 { + logger.Info("等待所有任务执行完成后退出") + } for { if taskNumInRunning <= 0 { break diff --git a/service/task.go b/service/task.go index 1815558..e332de8 100644 --- a/service/task.go +++ b/service/task.go @@ -274,7 +274,9 @@ func createJob(taskModel models.TaskHost) cron.FuncJob { if taskLogId <= 0 { return } + logger.Infof("开始执行任务#%s#命令-%s", taskModel.Task.Name, taskModel.Command) taskResult := execJob(handler, taskModel) + logger.Infof("任务完成#%s#命令-%s", taskModel.Task.Name, taskModel.Command) afterExecJob(taskModel, taskResult, taskLogId) }