Compare commits

...

2 Commits

Author SHA1 Message Date
5e529d11b4 add git-hook.service 2021-11-14 10:49:10 +08:00
959f06d5aa log 2021-11-12 17:44:35 +08:00
2 changed files with 31 additions and 0 deletions

28
git-hook.service Normal file
View File

@ -0,0 +1,28 @@
[Service]
Type=simple
User=www
Group=www
# 休眠10s等待数据库启动, 否则服务起不来
ExecStart=nohup /home/www/htdocs/git-hook/git_hook --config_path=/home/www/etc/git-hook >> /dev/null &
ExecStop=ps -ef | grep git_hook | grep -v grep | awk '{print $2}' | xargs kill -9
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
# Place temp files in a secure directory, not /tmp
PrivateTmp=true
# 后台运行
Restart=on-failure
RestartPreventExitStatus=1
# Sets open_files_limit
LimitNOFILE = 10000
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
Environment=MYSQLD_PARENT_PID=1
[Install]
WantedBy=multi-user.target

View File

@ -9,6 +9,7 @@ package main
import (
"encoding/json"
"fmt"
"time"
"git.zhangdeman.cn/zhangdeman/gopkg/cmd"
@ -37,6 +38,8 @@ func main() {
panic("任务配置文件读取失败 : " + err.Error())
}
fmt.Println("读取到的任务配置 : " + string(byteData))
if err = json.Unmarshal(byteData, &TaskList); nil != err {
panic("任务配置文件解析失败 : " + err.Error())
}