Files
GitBucket/contrib/redhat/gitbucket.init
Jiri Tyr 53269096a6 Allow to force HTTPS scheme
If the standalone GitBucket instance runs behind HTTPS proxy, the
repository URL always shows HTTP scheme dispute the fact that the
connection is HTTPS. This patch is adding a command line option which
allows to force the HTTPS scheme.
2013-10-21 14:32:53 +01:00

106 lines
1.7 KiB
Bash

#!/bin/bash
#
# /etc/rc.d/init.d/gitbucket
#
# Starts the GitBucket server
#
# chkconfig: 345 60 40
# description: Run GitBucket server
# processname: java
# Source function library
. /etc/rc.d/init.d/functions
# Default values
GITBUCKET_PORT=8080
GITBUCKET_HOME=/var/lib/gitbucket
GITBUCKET_WAR_FILE=/usr/share/gitbucket/lib/gitbucket.war
# Pull in cq settings
[ -f /etc/sysconfig/gitbucket ] && . /etc/sysconfig/gitbucket
# Location of the log and PID file
LOG_FILE=/var/log/gitbucket/run.log
PID_FILE=/var/run/gitbucket.pid
# Default return value
RETVAL=0
start() {
echo -n $"Starting GitBucket server: "
# Compile statup parameters
START_OPTS="--port=${GITBUCKET_PORT}"
if [ $GITBUCKET_PREFIX ]; then
START_OPTS="${START_OPTS} --prefix ${GITBUCKET_PREFIX}"
fi
if [ $GITBUCKET_HTTPS ]; then
START_OPTS="${START_OPTS} --https=true"
fi
# Run the Java process
GITBUCKET_HOME="${GITBUCKET_HOME}" java $GITBUCKET_JVM_OPTS -jar $GITBUCKET_WAR_FILE $START_OPTS >>$LOG_FILE 2>&1 &
RETVAL=$?
# Store PID of the Java process into a file
echo $! > $PID_FILE
if [ $RETVAL -eq 0 ] ; then
success "GitBucket startup"
else
failure "GitBucket startup"
fi
echo
return $RETVAL
}
stop() {
echo -n $"Stopping GitBucket server: "
# Run the Java process
kill $(cat $PID_FILE 2>/dev/null) >>$LOG_FILE 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
rm -f $PID_FILE
success "GitBucket stopping"
else
failure "GitBucket stopping"
fi
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $PID_FILE java
RETVAL=$?
;;
*)
echo $"Usage: $0 [start|stop|restart|status]"
RETVAL=2
esac
exit $RETVAL