bin-utils/mgpaster
2015-05-30 18:42:42 +02:00

48 lines
1.3 KiB
Bash

#!/bin/sh
# PROVIDE: mgpaster
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
. /etc/rc.subr
name="mgpaster"
rcvar="mgpaster_enable"
load_rc_config $name
: ${mgpaster_enable:="NO"}
: ${mgpaster_path:="/usr/local/www/photos.meutel.net/mediagoblin"}
: ${mgpaster_user:="www"}
: ${mgpaster_pasteini:="paste_local.ini"}
: ${mgpaster_logdir:="/var/log/mediagoblin"}
: ${mgpaster_eggcache:="/usr/local/www/.python-eggs"}
: ${mgpaster_host:="10.42.0.90"}
: ${mgpaster_port:="26543"}
: ${mgpaster_celery_eager:="false"}
pidfile="/var/run/${name}.pid"
required_files="$mgpaster_path/$mgpaster_pasteini"
required_dirs="$mgpaster_path $mgpaster_path/bin $mgpaster_logdir"
start_precmd="${name}_prestart"
mgpaster_chdir=$mgpaster_path
command="$mgpaster_path/bin/paster"
command_interpreter="$mgpaster_path/bin/python"
command_args=" > $mgpaster_logdir/${name}_start.log 2>&1"
mgpaster_flags=" serve $mgpaster_path/$mgpaster_pasteini --server-name=fcgi \
fcgi_host=$mgpaster_host fcgi_port=$mgpaster_port \
--pid-file $pidfile --log-file ${mgpaster_logdir}/${name}.log --daemon $mgpaster_flags"
mgpaster_prestart()
{
touch $pidfile
chown $mgpaster_user $pidfile
CELERY_ALWAYS_EAGER=$mgpaster_celery_eager
export CELERY_ALWAYS_EAGER
PYTHON_EGG_CACHE="$mgpaster_eggcache"
export PYTHON_EGG_CACHE
}
run_rc_command "$1"