code.gitea.io/gitea@v1.21.7/contrib/init/centos/gitea (about) 1 #!/bin/sh 2 # 3 # /etc/rc.d/init.d/gitea 4 # 5 # Runs the Gitea Git with a cup of tea. 6 # 7 # 8 # chkconfig: - 85 15 9 # 10 11 ### BEGIN INIT INFO 12 # Provides: gitea 13 # Required-Start: $remote_fs $syslog 14 # Required-Stop: $remote_fs $syslog 15 # Default-Start: 2 3 4 5 16 # Default-Stop: 0 1 6 17 # Short-Description: Start gitea at boot time. 18 # Description: Control gitea. 19 ### END INIT INFO 20 21 # Source function library. 22 . /etc/init.d/functions 23 24 # Default values 25 26 NAME=gitea 27 GITEA_HOME=/var/lib/${NAME} 28 GITEA_PATH=/usr/local/bin/${NAME} 29 GITEA_USER=git 30 SERVICENAME="Gitea - Git with a cup of tea" 31 LOCKFILE=/var/lock/subsys/gitea 32 LOGPATH=${GITEA_HOME}/log 33 LOGFILE=${LOGPATH}/gitea.log 34 RETVAL=0 35 36 # Read configuration from /etc/sysconfig/gitea to override defaults 37 [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME 38 39 # Don't do anything if nothing is installed 40 [ -x ${GITEA_PATH} ] || exit 0 41 # exit if logpath dir is not created. 42 [ -x ${LOGPATH} ] || exit 0 43 44 DAEMON_OPTS="--check $NAME" 45 46 # Set additional options, if any 47 [ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}" 48 49 start() { 50 cd ${GITEA_HOME} 51 echo -n "Starting ${SERVICENAME}: " 52 daemon $DAEMON_OPTS "${GITEA_PATH} web -c /etc/${NAME}/app.ini > ${LOGFILE} 2>&1 &" 53 RETVAL=$? 54 echo 55 [ $RETVAL = 0 ] && touch ${LOCKFILE} 56 57 return $RETVAL 58 } 59 60 stop() { 61 cd ${GITEA_HOME} 62 echo -n "Shutting down ${SERVICENAME}: " 63 killproc ${NAME} 64 RETVAL=$? 65 echo 66 [ $RETVAL = 0 ] && rm -f ${LOCKFILE} 67 } 68 69 case "$1" in 70 start) 71 status ${NAME} > /dev/null 2>&1 && exit 0 72 start 73 ;; 74 stop) 75 stop 76 ;; 77 status) 78 status ${NAME} 79 ;; 80 restart) 81 stop 82 start 83 ;; 84 reload) 85 stop 86 start 87 ;; 88 *) 89 echo "Usage: ${NAME} {start|stop|status|restart}" 90 exit 1 91 ;; 92 esac 93 exit $RETVAL