mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-08 18:04:14 +01:00
b7263f31a5
Still use GOGS_WORK_DIR and GOGS_CUSTOM env variables as a fallback if the equivalent GITEA_* are not set, warning user about the need for change. Does not change "gogs" to "gitea" in webhook type name Because "gogs" hook type is part of the API (routes) and used in templates... Closes #87
93 lines
1.8 KiB
Bash
93 lines
1.8 KiB
Bash
#!/bin/sh
|
|
#
|
|
# /etc/rc.d/init.d/gogs
|
|
#
|
|
# Runs the Gogs Go Git Service.
|
|
#
|
|
#
|
|
# chkconfig: - 85 15
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: gogs
|
|
# Required-Start: $remote_fs $syslog
|
|
# Required-Stop: $remote_fs $syslog
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Start gogs at boot time.
|
|
# Description: Control gogs.
|
|
### END INIT INFO
|
|
|
|
# Source function library.
|
|
. /etc/init.d/functions
|
|
|
|
# Default values
|
|
|
|
NAME=gogs
|
|
GITEA_HOME=/home/git/gogs
|
|
GITEA_PATH=${GITEA_HOME}/$NAME
|
|
GITEA_USER=git
|
|
SERVICENAME="Gogs Go Git Service"
|
|
LOCKFILE=/var/lock/subsys/gogs
|
|
LOGPATH=${GITEA_HOME}/log
|
|
LOGFILE=${LOGPATH}/gogs.log
|
|
RETVAL=0
|
|
|
|
# Read configuration from /etc/sysconfig/gogs to override defaults
|
|
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
|
|
|
# Don't do anything if nothing is installed
|
|
[ -x ${GITEA_PATH} ] || exit 0
|
|
# exit if logpath dir is not created.
|
|
[ -x ${LOGPATH} ] || exit 0
|
|
|
|
DAEMON_OPTS="--check $NAME"
|
|
|
|
# Set additional options, if any
|
|
[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
|
|
|
|
start() {
|
|
cd ${GITEA_HOME}
|
|
echo -n "Starting ${SERVICENAME}: "
|
|
daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && touch ${LOCKFILE}
|
|
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
cd ${GITEA_HOME}
|
|
echo -n "Shutting down ${SERVICENAME}: "
|
|
killproc ${NAME}
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && rm -f ${LOCKFILE}
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
status ${NAME} > /dev/null 2>&1 && exit 0
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status ${NAME}
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
reload)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: ${NAME} {start|stop|status|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
exit $RETVAL
|