# HG changeset patch # User Bradley M. Kuhn # Date 1404342280 14400 # Node ID 99ad9d0af1a33eb4d8ffaf73f2138fd97f4067dc # Parent 9793473d74be78e0505ecd3d12b856f1dac3c640 Rename init scripts and fix references inside them diff -r 9793473d74be -r 99ad9d0af1a3 docs/upgrade.rst --- a/docs/upgrade.rst Wed Jul 02 19:04:39 2014 -0400 +++ b/docs/upgrade.rst Wed Jul 02 19:04:40 2014 -0400 @@ -20,7 +20,7 @@ If using a sqlite database, stop the Rhodecode process/daemon/service, and then make a copy of the database file:: - service rhodecode stop + service kallithea stop cp rhodecode.db rhodecode.db.{version} @@ -90,7 +90,7 @@ Once that is complete, you may now start your upgraded Rhodecode Instance:: - service rhodecode start + service kallithea start Or:: diff -r 9793473d74be -r 99ad9d0af1a3 init.d/celeryd-upstart.conf --- a/init.d/celeryd-upstart.conf Wed Jul 02 19:04:39 2014 -0400 +++ b/init.d/celeryd-upstart.conf Wed Jul 02 19:04:40 2014 -0400 @@ -1,19 +1,19 @@ -# celeryd - run the celeryd daemon as an upstart job for rhodecode +# celeryd - run the celeryd daemon as an upstart job for kallithea # Change variables/paths as necessary and place file /etc/init/celeryd.conf # start/stop/restart as normal upstart job (ie: $ start celeryd) description "Celery for RhodeCode Mercurial Server" author "Matt Zuba /dev/null + if [ $? = 0 ]; then + add_daemon $DAEMON + stat_done + else + stat_fail + exit 1 + fi + ;; +stop) + stat_busy "Stopping $DAEMON" + [ -n "$PID" ] && kill $PID &>/dev/null + if [ $? = 0 ]; then + rm_daemon $DAEMON + stat_done + else + stat_fail + exit 1 + fi + ;; +restart) + $0 stop + sleep 1 + $0 start + ;; +status) + stat_busy "Checking $name status"; + ck_status $name + ;; +*) + echo "usage: $0 {start|stop|restart|status}" +esac \ No newline at end of file diff -r 9793473d74be -r 99ad9d0af1a3 init.d/kallithea-daemon-debian --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/init.d/kallithea-daemon-debian Wed Jul 02 19:04:40 2014 -0400 @@ -0,0 +1,90 @@ +#!/bin/sh -e +######################################## +#### THIS IS A DEBIAN INIT.D SCRIPT #### +######################################## + +### BEGIN INIT INFO +# Provides: kallithea +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts instance of kallithea +# Description: starts instance of kallithea using start-stop-daemon +### END INIT INFO + +APP_NAME="kallithea" +APP_HOMEDIR="opt" +APP_PATH="/$APP_HOMEDIR/$APP_NAME" + +CONF_NAME="production.ini" + +PID_PATH="$APP_PATH/$APP_NAME.pid" +LOG_PATH="$APP_PATH/$APP_NAME.log" + +PYTHON_PATH="/$APP_HOMEDIR/$APP_NAME-venv" + +RUN_AS="root" + +DAEMON="$PYTHON_PATH/bin/paster" + +DAEMON_OPTS="serve --daemon \ + --user=$RUN_AS \ + --group=$RUN_AS \ + --pid-file=$PID_PATH \ + --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" + + +start() { + echo "Starting $APP_NAME" + PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \ + --start --quiet \ + --pidfile $PID_PATH \ + --user $RUN_AS \ + --exec $DAEMON -- $DAEMON_OPTS +} + +stop() { + echo "Stopping $APP_NAME" + start-stop-daemon -d $APP_PATH \ + --stop --quiet \ + --pidfile $PID_PATH || echo "$APP_NAME - Not running!" + + if [ -f $PID_PATH ]; then + rm $PID_PATH + fi +} + +status() { + echo -n "Checking status of $APP_NAME ... " + pid=`cat $PID_PATH` + status=`ps ax | grep $pid | grep -ve grep` + if [ "$?" -eq 0 ]; then + echo "running" + else + echo "NOT running" + fi +} + +case "$1" in + status) + status + ;; + start) + start + ;; + stop) + stop + ;; + restart) + echo "Restarting $APP_NAME" + ### stop ### + stop + wait + ### start ### + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac \ No newline at end of file diff -r 9793473d74be -r 99ad9d0af1a3 init.d/kallithea-daemon-gentoo --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/init.d/kallithea-daemon-gentoo Wed Jul 02 19:04:40 2014 -0400 @@ -0,0 +1,61 @@ +#!/sbin/runscript +######################################## +#### THIS IS AN GENTOO INIT.D SCRIPT#### +######################################## + +APP_NAME="kallithea" +APP_HOMEDIR="username/python_workspace" +APP_PATH="/home/$APP_HOMEDIR/$APP_NAME" + +CONF_NAME="production.ini" + +PID_PATH="$APP_PATH/$APP_NAME.pid" +LOG_PATH="$APP_PATH/$APP_NAME.log" + +PYTHON_PATH="/home/$APP_HOMEDIR/v-env" + +RUN_AS="username" + +DAEMON="$PYTHON_PATH/bin/paster" + +DAEMON_OPTS="serve --daemon \ +--user=$RUN_AS \ +--group=$RUN_AS \ +--pid-file=$PID_PATH \ +--log-file=$LOG_PATH $APP_PATH/$CONF_NAME" + +#extra options +opts="${opts} restartdelay" + +depend() { + need nginx +} + +start() { + ebegin "Starting $APP_NAME" + start-stop-daemon -d $APP_PATH -e PYTHON_EGG_CACHE="/tmp" \ + --start --quiet \ + --pidfile $PID_PATH \ + --user $RUN_AS \ + --exec $DAEMON -- $DAEMON_OPTS + eend $? +} + +stop() { + ebegin "Stopping $APP_NAME" + start-stop-daemon -d $APP_PATH \ + --stop --quiet \ + --pidfile $PID_PATH || echo "$APP_NAME - Not running!" + if [ -f $PID_PATH ]; then + rm $PID_PATH + fi + eend $? +} + +restartdelay() { + #stop() + echo "sleep3" + sleep 3 + + #start() +} diff -r 9793473d74be -r 99ad9d0af1a3 init.d/kallithea-daemon-redhat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/init.d/kallithea-daemon-redhat Wed Jul 02 19:04:40 2014 -0400 @@ -0,0 +1,132 @@ +#!/bin/sh +######################################## +#### THIS IS A REDHAT INIT.D SCRIPT #### +######################################## + +################################################## +# +# RhodeCode server startup script +# Recommended default-startup: 2 3 4 5 +# Recommended default-stop: 0 1 6 +# +################################################## + + +APP_NAME="kallithea" +# the location of your app +# since this is a web app, it should go in /var/www +APP_PATH="/var/www/$APP_NAME" + +CONF_NAME="production.ini" + +# write to wherever the PID should be stored, just ensure +# that the user you run paster as has the appropriate permissions +# same goes for the log file +PID_PATH="/var/run/kallithea/pid" +LOG_PATH="/var/log/kallithea/kallithea.log" + +# replace this with the path to the virtual environment you +# made for RhodeCode +PYTHON_PATH="/opt/python_virtualenvironments/kallithea-venv" + +RUN_AS="kallithea" + +DAEMON="$PYTHON_PATH/bin/paster" + +DAEMON_OPTS="serve --daemon \ + --user=$RUN_AS \ + --group=$RUN_AS \ + --pid-file=$PID_PATH \ + --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" + +DESC="kallithea-server" +LOCK_FILE="/var/lock/subsys/$APP_NAME" + +# source CentOS init functions +. /etc/init.d/functions + +RETVAL=0 + +remove_pid () { + rm -f ${PID_PATH} + rmdir `dirname ${PID_PATH}` +} + +ensure_pid_dir () { + PID_DIR=`dirname ${PID_PATH}` + if [ ! -d ${PID_DIR} ] ; then + mkdir -p ${PID_DIR} + chown -R ${RUN_AS}:${RUN_AS} ${PID_DIR} + chmod 755 ${PID_DIR} + fi +} + +start_kallithea () { + ensure_pid_dir + PYTHON_EGG_CACHE="/tmp" daemon --pidfile $PID_PATH \ + --user $RUN_AS "$DAEMON $DAEMON_OPTS" + RETVAL=$? + [ $RETVAL -eq 0 ] && touch $LOCK_FILE + return $RETVAL +} + +stop_kallithea () { + if [ -e $LOCK_FILE ]; then + killproc -p $PID_PATH + RETVAL=$? + rm -f $LOCK_FILE + rm -f $PID_PATH + else + RETVAL=1 + fi + return $RETVAL +} + +status_kallithea() { + if [ -e $LOCK_FILE ]; then + # exit with non-zero to indicate failure + RETVAL=1 + else + RETVAL=0 + fi + return $RETVAL +} + +restart_kallithea () { + stop_kallithea + start_kallithea + RETVAL=$? +} + +case "$1" in + start) + echo -n $"Starting $DESC: " + start_kallithea + echo + ;; + stop) + echo -n $"Stopping $DESC: " + stop_kallithea + echo + ;; + status) + status_kallithea + RETVAL=$? + if [ ! $RETVAL -eq 0 ]; then + echo "RhodeCode server is running..." + else + echo "RhodeCode server is stopped." + fi + ;; + restart) + echo -n $"Restarting $DESC: " + restart_kallithea + echo + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + RETVAL=1 + ;; +esac + +exit $RETVAL \ No newline at end of file diff -r 9793473d74be -r 99ad9d0af1a3 init.d/kallithea-upstart.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/init.d/kallithea-upstart.conf Wed Jul 02 19:04:40 2014 -0400 @@ -0,0 +1,26 @@ +# kallithea - run the kallithea daemon as an upstart job +# Change variables/paths as necessary and place file /etc/init/kallithea.conf +# start/stop/restart as normal upstart job (ie: $ start kallithea) + +description "RhodeCode Mercurial Server" +author "Matt Zuba /dev/null - if [ $? = 0 ]; then - add_daemon $DAEMON - stat_done - else - stat_fail - exit 1 - fi - ;; -stop) - stat_busy "Stopping $DAEMON" - [ -n "$PID" ] && kill $PID &>/dev/null - if [ $? = 0 ]; then - rm_daemon $DAEMON - stat_done - else - stat_fail - exit 1 - fi - ;; -restart) - $0 stop - sleep 1 - $0 start - ;; -status) - stat_busy "Checking $name status"; - ck_status $name - ;; -*) - echo "usage: $0 {start|stop|restart|status}" -esac \ No newline at end of file diff -r 9793473d74be -r 99ad9d0af1a3 init.d/rhodecode-upstart.conf --- a/init.d/rhodecode-upstart.conf Wed Jul 02 19:04:39 2014 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -# rhodecode - run the rhodecode daemon as an upstart job -# Change variables/paths as necessary and place file /etc/init/rhodecode.conf -# start/stop/restart as normal upstart job (ie: $ start rhodecode) - -description "RhodeCode Mercurial Server" -author "Matt Zuba