Merge pull request #1081 from CarlosGtrz/master

Remove use of PID and fix stderr redirection
tokarchuk/v1.17
无闻 10 years ago
commit 8fa2056e14
  1. 12
      scripts/init/centos/gogs

@ -28,7 +28,6 @@ GOGS_HOME=/home/git/gogs
GOGS_PATH=${GOGS_HOME}/$NAME GOGS_PATH=${GOGS_HOME}/$NAME
GOGS_USER=git GOGS_USER=git
SERVICENAME="Gogs Go Git Service" SERVICENAME="Gogs Go Git Service"
PID=/var/run/$NAME.pid
LOCKFILE=/var/lock/subsys/gogs LOCKFILE=/var/lock/subsys/gogs
LOGFILE=${GOGS_HOME}/log/gogs.log LOGFILE=${GOGS_HOME}/log/gogs.log
RETVAL=0 RETVAL=0
@ -39,7 +38,7 @@ RETVAL=0
# Don't do anything if nothing is installed # Don't do anything if nothing is installed
[ -x ${GOGS_PATH} ] || exit 0 [ -x ${GOGS_PATH} ] || exit 0
DAEMON_OPTS="" DAEMON_OPTS="--check $NAME"
# Set additional options, if any # Set additional options, if any
[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}" [ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"
@ -47,8 +46,7 @@ DAEMON_OPTS=""
start() { start() {
cd ${GOGS_HOME} cd ${GOGS_HOME}
echo -n "Starting ${SERVICENAME}: " echo -n "Starting ${SERVICENAME}: "
daemon $DAEMON_OPTS --pidfile=${PID} "${GOGS_PATH} web 2>&1 > ${LOGFILE} &" daemon $DAEMON_OPTS "${GOGS_PATH} web > ${LOGFILE} 2>&1 &"
echo $! > ${PID}
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL = 0 ] && touch ${LOCKFILE} [ $RETVAL = 0 ] && touch ${LOCKFILE}
@ -59,10 +57,10 @@ start() {
stop() { stop() {
cd ${GOGS_HOME} cd ${GOGS_HOME}
echo -n "Shutting down ${SERVICENAME}: " echo -n "Shutting down ${SERVICENAME}: "
killproc -p ${PID} ${NAME} killproc ${NAME}
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PID} [ $RETVAL = 0 ] && rm -f ${LOCKFILE}
} }
case "$1" in case "$1" in
@ -74,7 +72,7 @@ case "$1" in
stop stop
;; ;;
status) status)
status -p ${PID} ${NAME} status ${NAME}
;; ;;
restart) restart)
stop stop

Loading…
Cancel
Save