bench-forgejo/scripts/init/centos/gitea

94 lines
1.8 KiB
Text
Raw Normal View History

2014-09-29 14:11:29 +05:30
#!/bin/sh
#
# /etc/rc.d/init.d/gitea
2014-09-29 14:11:29 +05:30
#
2016-12-02 10:48:58 +05:30
# Runs the Gitea Git with a cup of tea.
2014-09-29 14:11:29 +05:30
#
2016-12-02 10:48:58 +05:30
#
# chkconfig: - 85 15
2014-09-29 14:11:29 +05:30
#
### BEGIN INIT INFO
# Provides: gitea
2014-09-29 14:11:29 +05:30
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start gitea at boot time.
# Description: Control gitea.
2014-09-29 14:11:29 +05:30
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Default values
NAME=gitea
GITEA_HOME=/home/git/gitea
GITEA_PATH=${GITEA_HOME}/$NAME
GITEA_USER=git
2016-12-02 23:22:28 +05:30
SERVICENAME="Gitea - Git with a cup of tea"
LOCKFILE=/var/lock/subsys/gitea
LOGPATH=${GITEA_HOME}/log
LOGFILE=${LOGPATH}/gitea.log
2014-09-29 14:11:29 +05:30
RETVAL=0
# Read configuration from /etc/sysconfig/gitea to override defaults
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
2014-09-29 14:11:29 +05:30
# Don't do anything if nothing is installed
[ -x ${GITEA_PATH} ] || exit 0
2015-10-31 18:02:34 +05:30
# exit if logpath dir is not created.
[ -x ${LOGPATH} ] || exit 0
2014-09-29 14:11:29 +05:30
DAEMON_OPTS="--check $NAME"
2014-09-29 14:11:29 +05:30
# Set additional options, if any
[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
2014-09-29 14:11:29 +05:30
start() {
cd ${GITEA_HOME}
2014-09-29 14:11:29 +05:30
echo -n "Starting ${SERVICENAME}: "
daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
2014-09-29 14:11:29 +05:30
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${LOCKFILE}
return $RETVAL
}
stop() {
cd ${GITEA_HOME}
2014-09-29 14:11:29 +05:30
echo -n "Shutting down ${SERVICENAME}: "
killproc ${NAME}
2014-09-29 14:11:29 +05:30
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${LOCKFILE}
2014-09-29 14:11:29 +05:30
}
case "$1" in
start)
status ${NAME} > /dev/null 2>&1 && exit 0
start
;;
stop)
stop
;;
status)
status ${NAME}
2014-09-29 14:11:29 +05:30
;;
restart)
stop
start
;;
reload)
stop
start
;;
*)
echo "Usage: ${NAME} {start|stop|status|restart}"
exit 1
;;
esac
exit $RETVAL