Skip to content

Instantly share code, notes, and snippets.

@riffm
Created August 3, 2009 14:54
Show Gist options
  • Save riffm/160600 to your computer and use it in GitHub Desktop.
Save riffm/160600 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Script for starting multiple fcgi instance.
# Count of instances is first argument of script.
PARAMS="runfcgi method=threaded daemonize=yes errlog=errlog.log workdir=./"
case $2 in
"start")
if [ $1 -le 1 ]
then
echo Please provide count of fcgi instances
exit 1
fi
for inst in $(seq $1)
do
python ./manage.py $PARAMS socket=instance$inst.sock pidfile=instance$inst.pid
done
;;
"stop")
for inst in $(ls *.pid)
do
kill $(cat $inst)
rm ./$inst
done
for inst in $(ls *.sock)
do
rm ./$inst
done
;;
*)
echo Usage instance_count \(start\|stop\)
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment