123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #!/bin/sh
- NAME=gogs
- GOGS_HOME=/home/git/gogs
- GOGS_PATH=${GOGS_HOME}/$NAME
- GOGS_USER=git
- SERVICENAME="Gogs"
- LOCKFILE=/var/lock/subsys/gogs
- LOGPATH=${GOGS_HOME}/log
- LOGFILE=${LOGPATH}/error.log
- RETVAL=0
- [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
- test -x ${GOGS_PATH} || { echo "$NAME not installed";
- if [ "$1" = "stop" ]; then exit 0;
- else exit 5; fi; }
- test -r ${LOGPATH} || { echo "$LOGPATH not existing";
- if [ "$1" = "stop" ]; then exit 0;
- else exit 6; fi; }
- . /etc/rc.status
- rc_reset
- case "$1" in
- start)
- echo -n "Starting ${SERVICENAME} "
-
- /sbin/checkproc ${GOGS_PATH}
- if [ $? -eq 0 ]; then
-
- (exit 5)
- else
- su - ${GOGS_USER} -c "USER=${GOGS_USER} ${GOGS_PATH} web 2>&1 >>${LOGFILE} &"
- fi
-
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down ${SERVICENAME} "
-
-
- /sbin/killproc ${GOGS_PATH}
-
- rc_status -v
- ;;
- restart)
-
-
- $0 stop
- $0 start
-
- rc_status
- ;;
- status)
- echo -n "Checking for ${SERVICENAME} "
-
-
-
-
-
-
-
-
-
-
- /sbin/checkproc ${GOGS_PATH}
-
-
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart}"
- exit 1
- ;;
- esac
- rc_exit
|