updated scripts as to what I have working in prod plus mods for rtylers comments
This commit is contained in:
parent
59a2afb66b
commit
51b1551c05
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# spawning Starts Spawning
|
||||
# spawning.$app_name Starts Spawning
|
||||
#
|
||||
#
|
||||
# chkconfig: 345 88 12
|
||||
|
@ -13,22 +13,24 @@
|
|||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# config
|
||||
if [ -f /etc/sysconfig/spawning.my-app-name ]; then
|
||||
. /etc/sysconfig/spawning.my-app-name
|
||||
if [ -f /etc/sysconfig/spawning.$app_name ]; then
|
||||
. /etc/sysconfig/spawning.$app_name
|
||||
fi
|
||||
|
||||
name="spawning.my-app-name"
|
||||
name="spawning.$app_name"
|
||||
prog="spawning"
|
||||
exec=/usr/bin/spawning #Path to Spawning executable
|
||||
exec=$exec #Path to Spawning executable
|
||||
|
||||
description="Starts a Spawning daemon to run the internets"
|
||||
# This is where your app or settings.py lives
|
||||
|
||||
# Don't edit this
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
lockfile=/var/lock/subsys/${prog}
|
||||
PIDFILE=/var/run/$name.pid
|
||||
lockfile=/var/lock/subsys/${name}
|
||||
|
||||
export PYTHONPATH=${python_path}
|
||||
if [ $python_path ]; then
|
||||
export PYTHONPATH=${python_path}
|
||||
fi
|
||||
|
||||
# make sure the access_log file exists
|
||||
if [ ! -e $access_log ]; then
|
||||
|
@ -43,18 +45,24 @@ start() {
|
|||
|
||||
|
||||
echo -n "Starting $name on $host:$port...: "
|
||||
echo -e "\n"
|
||||
|
||||
conf="--host=$host --port=$port"
|
||||
conf="$conf --stderr=$error_log --access-log-file=$access_log"
|
||||
[ -n "$pocesses" ] && conf="$conf --processes=$processes"
|
||||
[ -n "$threads" ] && conf="$conf --threads=$threads"
|
||||
[ -n "$factory" ] && conf="$conf --factory=$factory"
|
||||
conf="$conf $app"
|
||||
[ -n "$threads" ] && conf="$conf --threads=$threads"
|
||||
[ -n "$factory" ] && conf="$conf --factory=$factory"
|
||||
[ -n "$dev" ] && conf="$conf --reload=dev"
|
||||
[ -n "$CHUID" ] && conf="$conf --chuid=$CHUID"
|
||||
|
||||
conf="$conf $app"
|
||||
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
daemon $exec --daemonize $conf
|
||||
retval=$?
|
||||
echo
|
||||
|
||||
echo -e "\n"
|
||||
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
@ -97,4 +105,4 @@ case "$1" in
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit $?
|
||||
exit $?
|
|
@ -1,17 +1,31 @@
|
|||
# CONFIGURATION - edit this stuff with your keyboard.
|
||||
|
||||
app_name=app_name # necessary for namespacing
|
||||
# this will effect the site directory, log paths, user name
|
||||
# and expected location of this file from the init.d script
|
||||
# though there is nothing stopping you from changing each of those settings by hand
|
||||
|
||||
processes=2 # Number of processes to spawn
|
||||
threads=8 # Number of threads to spawn
|
||||
|
||||
port="80"
|
||||
host="0.0.0.0" # listen on loopback by default
|
||||
port="8080"
|
||||
host="localhost" # listen on loopback by default
|
||||
|
||||
# Django by default: delete this var to run a WSGI app
|
||||
factory="spawning.django_factory.config_factory"
|
||||
site_dir=/var/www/your-site/
|
||||
site_dir=/var/www/$app_name
|
||||
exec=${site_dir}/bin/spawning
|
||||
|
||||
app="settings" # Django by default, but put your own app here
|
||||
|
||||
access_log=/var/log/spawning/access_log
|
||||
error_log=/var/log/spawning/error_log
|
||||
CHUID="$app_name" # if running multiple insances of spawning
|
||||
# setup a user for each application
|
||||
# in addition .bashrc files that set paths are likely necessary as well
|
||||
|
||||
python_path=$site_dir:/usr/lib/python26.zip:/usr/lib/python2.6:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload:/usr/lib/python2.6/site-packages
|
||||
access_log=/var/log/spawning.$app_name/access_log # to have logging "off" ... set these vars to /dev/null
|
||||
error_log=/var/log/spawning.$app_name/error_log
|
||||
|
||||
#python_path=$site_dir:/usr/lib/python26.zip:/usr/lib/python2.6:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload:/usr/lib/python2.6/site-packages
|
||||
# a default fedora install will not have a pythonpath available to init scripts ...
|
||||
# these are the paths for fedora 13 ...
|
||||
# your milage may vary... though this variable is very likely necessary to get your script to work
|
Loading…
Reference in New Issue