adding rc-scripts for fedora

This commit is contained in:
noah 2010-10-22 18:03:13 -04:00 committed by R. Tyler Croy
parent a7d455bb32
commit 59a2afb66b
2 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,100 @@
#!/bin/bash
#
# spawning Starts Spawning
#
#
# chkconfig: 345 88 12
# description: Spawning is a lightweight http daemon.
### BEGIN INIT INFO
# Provides: $spawning
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# config
if [ -f /etc/sysconfig/spawning.my-app-name ]; then
. /etc/sysconfig/spawning.my-app-name
fi
name="spawning.my-app-name"
prog="spawning"
exec=/usr/bin/spawning #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}
export PYTHONPATH=${python_path}
# make sure the access_log file exists
if [ ! -e $access_log ]; then
touch $access_log
fi
# make sure the error log file exists
if [ ! -e $error_log ]; then
touch $error_log
fi
start() {
echo -n "Starting $name on $host:$port...: "
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"
# if not running, start it up here, usually something like "daemon $exec"
daemon $exec --daemonize $conf
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop () {
echo -n $"Stopping $prog: "
# stop it here, often "killproc $prog"
killproc $prog
retval=$?
echo
return $retval
}
status() {
if [ -f "$PIDFILE" ]; then
echo -n "$name already running with PIDs: " && cat $PIDFILE && echo
else
echo "$name not running"
fi
return
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
sleep 1
start
;;
*)
echo "Usage: $name (start|stop|status|restart)"
exit 1
;;
esac
exit $?

View File

@ -0,0 +1,17 @@
# CONFIGURATION - edit this stuff with your keyboard.
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
# Django by default: delete this var to run a WSGI app
factory="spawning.django_factory.config_factory"
site_dir=/var/www/your-site/
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
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