Create gogs.initd

This commit is contained in:
KronoZed 2016-10-31 15:04:52 +03:00 committed by GitHub
parent c4b47ce447
commit f2be17be00
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
runas=${runas:-gogs}
pidfile=${pidfile:-/var/run/gogs.pid}
work_dir=${work_dir:-/var/lib/gogs}
custom_dir=${custom_dir:-${work_dir}/custom}
depend() {
use net
after dns
}
start() {
ebegin "Starting Gogs: Go Git Service"
checkpath -d -m 0755 -o ${runas}:${runas} /var/lib/${runas}
start-stop-daemon --background --start --quiet \
--pidfile ${pidfile} --make-pidfile \
--user ${runas} --chdir ${work_dir} \
--exec env GOGS_WORK_DIR=${work_dir} \
GOGS_CUSTOM=${custom_dir} /usr/bin/gogs \
-- web
eend $?
}
stop() {
ebegin "Stopping Gogs: Go Git Service"
start-stop-daemon --stop --quiet --exec /usr/bin/gogs \
--pidfile ${pidfile} --name ${runas}
eend $?
}