##// END OF EJS Templates
Added suggested init.d modifications
Added suggested init.d modifications

File last commit:

r0:be62c3b6 default
r1:8b39dc58 tip default
Show More
rhodecode-daemon-arch
80 lines | 1.6 KiB | text/plain | TextLexer
/ rhodecode-daemon-arch
#!/bin/bash
###########################################
#### THIS IS AN ARCH LINUX RC.D SCRIPT ####
###########################################
. /etc/rc.conf
. /etc/rc.d/functions
## fix for locale not loading when starting service
## uncomment if you have issues with accent characters after RhodeCode starts
## on boot
#if [ -r /etc/default/locale ]; then
# . /etc/default/locale
# export LANG
#fi
DAEMON=rhodecode
APP_HOMEDIR="/srv"
APP_PATH="$APP_HOMEDIR/$DAEMON"
CONF_NAME="production.ini"
LOG_FILE="/var/log/$DAEMON.log"
PID_FILE="/run/daemons/$DAEMON"
APPL=/usr/bin/paster
RUN_AS_USER="rhodecode"
RUN_AS_GROUP="rhodecode"
ARGS="serve --daemon \
--user=$RUN_AS_USER \
--group=$RUN_AS_GROUP \
--pid-file=$PID_FILE \
--log-file=$LOG_FILE \
$APP_PATH/$CONF_NAME"
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
if [[ -r $PID_FILE ]]; then
read -r PID < "$PID_FILE"
if [[ $PID && ! -d /proc/$PID ]]; then
unset PID
rm_daemon $DAEMON
fi
fi
case "$1" in
start)
stat_busy "Starting $DAEMON"
export HOME=$APP_PATH
[ -z "$PID" ] && $APPL $ARGS &>/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