From 51b1551c057579716f9cf4905efa9b553779296e Mon Sep 17 00:00:00 2001 From: "K. Noah" Date: Wed, 27 Oct 2010 22:57:09 -0400 Subject: [PATCH] updated scripts as to what I have working in prod plus mods for rtylers comments --- rc-scripts/.DS_Store | Bin 0 -> 6148 bytes rc-scripts/init.d/spawning.fedora | 34 +++++++++++++++++---------- rc-scripts/sysconfig/spawning.fedora | 26 +++++++++++++++----- 3 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 rc-scripts/.DS_Store diff --git a/rc-scripts/.DS_Store b/rc-scripts/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a5ae6e6aaccdd168c952797073d30ccf773b5306 GIT binary patch literal 6148 zcmeHK-AV#c5T2t}yZwMSL6?WFMbrcdx>%&3%Rs@4jM{Z87sQozMZ&D57wQ#yik_$M z{1}OK(M?3oz?^TGGjk5}t(z#qx!yeWgp1vz|Oq=rhU`29snI z4B}uZnjL?U0rll2$5jB9||$t#3HarnBAcM8hziG~@9wOwL>V zc+!f(>%hOe(01yl76q_?PEvV?KmF5?%L>16sG;l;@)&xYaEtjwN{^%Y1@C8Jw9cIKY^c`mK}?8c!sf1N|^Kp0d7?ZE+upi?NN+c zZ&2;+=k56!jLZNtzznPe1NI?xwpOBAE|M8w27bbTdLJZIp=U8OsGkljdISI#;MM|L z%@Qg{TJ$Vt2C)MXCKYH>g&i@3NrzwBIL~5c(4>>lH{%?8v#=A2(6_@cbvOynAg{~- zGqA{jn*AU})&EbvpZ|3bFU$Zl@IM(4h2z$76Sdjix>Tj=wGw&-RiffDgC8j{bSp-z eYQ=j{E$~Za06mMDL3kkiM?llS3p4Pm47>wfuuu^I literal 0 HcmV?d00001 diff --git a/rc-scripts/init.d/spawning.fedora b/rc-scripts/init.d/spawning.fedora index 95aeea4..aa0dbe9 100644 --- a/rc-scripts/init.d/spawning.fedora +++ b/rc-scripts/init.d/spawning.fedora @@ -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 $? \ No newline at end of file diff --git a/rc-scripts/sysconfig/spawning.fedora b/rc-scripts/sysconfig/spawning.fedora index 7a14e7b..f0e91bd 100644 --- a/rc-scripts/sysconfig/spawning.fedora +++ b/rc-scripts/sysconfig/spawning.fedora @@ -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 \ No newline at end of file