From 5e529d11b422964aaef38e60790de635f0dbce36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sun, 14 Nov 2021 10:49:10 +0800 Subject: [PATCH] add git-hook.service --- git-hook.service | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 git-hook.service diff --git a/git-hook.service b/git-hook.service new file mode 100644 index 0000000..ac0f63a --- /dev/null +++ b/git-hook.service @@ -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 \ No newline at end of file