46 lines
1.2 KiB
Bash
46 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: mgceleryd
|
|
# REQUIRE: LOGIN cleanvar
|
|
# KEYWORD: shutdown
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="mgceleryd"
|
|
rcvar="mgceleryd_enable"
|
|
|
|
load_rc_config $name
|
|
: ${mgceleryd_enable:="NO"}
|
|
: ${mgceleryd_path:="/usr/local/www/photos.meutel.net/mediagoblin"}
|
|
: ${mgceleryd_user:="www"}
|
|
: ${mgceleryd_mgconfig:="$mgceleryd_path/mediagoblin_local.ini"}
|
|
: ${mgceleryd_config_module:="mediagoblin.init.celery.from_celery"}
|
|
: ${mgceleryd_logdir:="/var/log/mediagoblin"}
|
|
: ${mgceleryd_eggcache:="/usr/local/www/.python-eggs"}
|
|
|
|
pidfile="/var/run/${name}.pid"
|
|
required_files="$mgceleryd_mgconfig"
|
|
required_dirs="$mgceleryd_path $mgceleryd_path/bin $mgceleryd_logdir"
|
|
|
|
start_precmd="${name}_prestart"
|
|
mgceleryd_chdir=$mgceleryd_path
|
|
command="$mgceleryd_path/bin/celery"
|
|
command_args=" > $mgceleryd_logdir/${name}_start.log 2>&1 &"
|
|
command_interpreter="$mgceleryd_path/bin/python"
|
|
|
|
mgceleryd_flags=" worker --pidfile $pidfile -f ${mgceleryd_logdir}/${name}.log $mgceleryd_flags"
|
|
|
|
mgceleryd_prestart()
|
|
{
|
|
touch $pidfile
|
|
chown $mgceleryd_user $pidfile
|
|
MEDIAGOBLIN_CONFIG=$mgceleryd_mgconfig
|
|
export MEDIAGOBLIN_CONFIG
|
|
CELERY_CONFIG_MODULE=$mgceleryd_config_module
|
|
export CELERY_CONFIG_MODULE
|
|
PYTHON_EGG_CACHE="$mgceleryd_eggcache"
|
|
export PYTHON_EGG_CACHE
|
|
}
|
|
|
|
run_rc_command "$1"
|