|
|
@ -1,38 +1,38 @@ |
|
|
|
#!/bin/sh |
|
|
|
#!/bin/sh |
|
|
|
# |
|
|
|
# |
|
|
|
# /etc/init.d/gogs |
|
|
|
# /etc/init.d/gitea |
|
|
|
# |
|
|
|
# |
|
|
|
# Runs the Gogs Go Git Service. |
|
|
|
# Runs the Gogs Go Git Service. |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
### BEGIN INIT INFO |
|
|
|
### BEGIN INIT INFO |
|
|
|
# Provides: gogs |
|
|
|
# Provides: gitea |
|
|
|
# Required-Start: $remote_fs |
|
|
|
# Required-Start: $remote_fs |
|
|
|
# Required-Stop: $remote_fs |
|
|
|
# Required-Stop: $remote_fs |
|
|
|
# Default-Start: 2 3 4 5 |
|
|
|
# Default-Start: 2 3 4 5 |
|
|
|
# Default-Stop: 0 1 6 |
|
|
|
# Default-Stop: 0 1 6 |
|
|
|
# Short-Description: Start gogs at boot time. |
|
|
|
# Short-Description: Start gitea at boot time. |
|
|
|
# Description: Control gogs. |
|
|
|
# Description: Control gitea. |
|
|
|
### END INIT INFO |
|
|
|
### END INIT INFO |
|
|
|
|
|
|
|
|
|
|
|
# Default values |
|
|
|
# Default values |
|
|
|
|
|
|
|
|
|
|
|
NAME=gogs |
|
|
|
NAME=gitea |
|
|
|
GOGS_HOME=/home/git/gogs |
|
|
|
GITEA_HOME=/home/git/gitea |
|
|
|
GOGS_PATH=${GOGS_HOME}/$NAME |
|
|
|
GITEA_PATH=${GITEA_HOME}/$NAME |
|
|
|
GOGS_USER=git |
|
|
|
GITEA_USER=git |
|
|
|
SERVICENAME="Go Git Service" |
|
|
|
SERVICENAME="Go Git Service" |
|
|
|
LOCKFILE=/var/lock/subsys/gogs |
|
|
|
LOCKFILE=/var/lock/subsys/gitea |
|
|
|
LOGPATH=${GOGS_HOME}/log |
|
|
|
LOGPATH=${GITEA_HOME}/log |
|
|
|
LOGFILE=${LOGPATH}/error.log |
|
|
|
LOGFILE=${LOGPATH}/error.log |
|
|
|
# gogs creates its own gogs.log from stdout |
|
|
|
# gitea creates its own gitea.log from stdout |
|
|
|
RETVAL=0 |
|
|
|
RETVAL=0 |
|
|
|
|
|
|
|
|
|
|
|
# Read configuration from /etc/sysconfig/gogs to override defaults |
|
|
|
# Read configuration from /etc/sysconfig/gitea to override defaults |
|
|
|
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME |
|
|
|
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME |
|
|
|
|
|
|
|
|
|
|
|
# Don't do anything if nothing is installed |
|
|
|
# Don't do anything if nothing is installed |
|
|
|
test -x ${GOGS_PATH} || { echo "$NAME not installed"; |
|
|
|
test -x ${GITEA_PATH} || { echo "$NAME not installed"; |
|
|
|
if [ "$1" = "stop" ]; then exit 0; |
|
|
|
if [ "$1" = "stop" ]; then exit 0; |
|
|
|
else exit 5; fi; } |
|
|
|
else exit 5; fi; } |
|
|
|
|
|
|
|
|
|
|
@ -53,12 +53,12 @@ case "$1" in |
|
|
|
echo -n "Starting ${SERVICENAME} " |
|
|
|
echo -n "Starting ${SERVICENAME} " |
|
|
|
|
|
|
|
|
|
|
|
# As we can't use startproc, we have to check ourselves if the service is already running |
|
|
|
# As we can't use startproc, we have to check ourselves if the service is already running |
|
|
|
/sbin/checkproc ${GOGS_PATH} |
|
|
|
/sbin/checkproc ${GITEA_PATH} |
|
|
|
if [ $? -eq 0 ]; then |
|
|
|
if [ $? -eq 0 ]; then |
|
|
|
# return skipped as service is already running |
|
|
|
# return skipped as service is already running |
|
|
|
(exit 5) |
|
|
|
(exit 5) |
|
|
|
else |
|
|
|
else |
|
|
|
su - ${GOGS_USER} -c "USER=${GOGS_USER} ${GOGS_PATH} web 2>&1 >>${LOGFILE} &" |
|
|
|
su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Remember status and be verbose |
|
|
|
# Remember status and be verbose |
|
|
@ -70,7 +70,7 @@ case "$1" in |
|
|
|
|
|
|
|
|
|
|
|
## Stop daemon with killproc(8) and if this fails |
|
|
|
## Stop daemon with killproc(8) and if this fails |
|
|
|
## killproc sets the return value according to LSB. |
|
|
|
## killproc sets the return value according to LSB. |
|
|
|
/sbin/killproc ${GOGS_PATH} |
|
|
|
/sbin/killproc ${GITEA_PATH} |
|
|
|
|
|
|
|
|
|
|
|
# Remember status and be verbose |
|
|
|
# Remember status and be verbose |
|
|
|
rc_status -v |
|
|
|
rc_status -v |
|
|
@ -100,7 +100,7 @@ case "$1" in |
|
|
|
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) |
|
|
|
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) |
|
|
|
|
|
|
|
|
|
|
|
# NOTE: checkproc returns LSB compliant status values. |
|
|
|
# NOTE: checkproc returns LSB compliant status values. |
|
|
|
/sbin/checkproc ${GOGS_PATH} |
|
|
|
/sbin/checkproc ${GITEA_PATH} |
|
|
|
# NOTE: rc_status knows that we called this init script with |
|
|
|
# NOTE: rc_status knows that we called this init script with |
|
|
|
# "status" option and adapts its messages accordingly. |
|
|
|
# "status" option and adapts its messages accordingly. |
|
|
|
rc_status -v |
|
|
|
rc_status -v |