0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-27 23:48:39 +01:00
gitea/scripts/init/freebsd/gogs

48 lines
819 B
Plaintext
Raw Normal View History

2015-01-31 04:51:38 +01:00
#!/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}/gogs web"
procname="$(echo $command |cut -d' ' -f1)"
2015-01-31 04:51:38 +01:00
pidfile="${gogs_directory}/${name}.pid"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
gogs_start() {
cd ${gogs_directory}
export USER=${gogs_user}
2015-11-12 18:36:35 +01:00
export HOME=/usr/home/${gogs_user}
2015-01-31 04:51:38 +01:00
/usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
}
gogs_stop() {
if [ ! -f $pidfile ]; then
echo "GITEA PID File not found. Maybe GITEA is not running?"
2015-01-31 04:51:38 +01:00
else
kill $(cat $pidfile)
fi
}
run_rc_command "$1"