0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-23 00:58:01 +01:00

Merge pull request #885 from clinta/dev

Add a freebsd init script.
This commit is contained in:
无闻 2015-01-30 23:00:51 -05:00
commit 69d98e9edd

46
scripts/init/freebsd/gogs Normal file
View file

@ -0,0 +1,46 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: gogs
# REQUIRE: NETWORKING SYSLOG
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable gogs:
#
#gogs_enable="YES"
. /etc/rc.subr
name="gogs"
rcvar="gogs_enable"
load_rc_config $name
: ${gogs_user:="git"}
: ${gogs_enable:="NO"}
: ${gogs_directory:="/home/git"}
command="${gogs_directory}/scripts/start.sh"
pidfile="${gogs_directory}/${name}.pid"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
gogs_start() {
cd ${gogs_directory}
export USER=${gogs_user}
export HOME=${gogs_directory}
/usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
}
gogs_stop() {
if [ ! -f $pidfile ]; then
echo "GOGS PID File not found. Maybe GOGS is not running?"
else
kill $(cat $pidfile)
fi
}
run_rc_command "$1"