mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-13 06:09:51 +01:00
4db0e1d340
If the init script is called with `status`, the rc.subr(8) routines check if the first argument associated with the pid in the pidfile is equal to `procname`. By default, `procname` is equal to the value of `command`. In our case, `command` contains a space (i.e. has multiple arguments), so `procname` can never be equal to the first argument of the command associated with the pid. Set `procname` to the first argument of `command` to fix the `status` command of the init script.
47 lines
817 B
Bash
47 lines
817 B
Bash
#!/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)"
|
|
|
|
pidfile="${gogs_directory}/${name}.pid"
|
|
|
|
start_cmd="${name}_start"
|
|
stop_cmd="${name}_stop"
|
|
|
|
gogs_start() {
|
|
cd ${gogs_directory}
|
|
export USER=${gogs_user}
|
|
export HOME=/usr/home/${gogs_user}
|
|
/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"
|