Created
August 23, 2011 12:40
-
-
Save lstoll/1165000 to your computer and use it in GitHub Desktop.
hacky way to run and mange a bunch of processes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
old_mongo_pid=`ps auxww | grep mongod | egrep -v grep | awk '{print $2}'` | |
# Start mongo and memcache if not running | |
ps aux | grep mongod | grep -v grep || mongod & | |
#ps aux | grep memcached | grep -v grep || memcached & pids="$pids $!" | |
if [ "$old_mongo_pid" == "" ] | |
then | |
echo "mongo wasnt running" | |
sleep 1 | |
pids="`ps auxww | grep mongod | egrep -v grep | awk '{print $2}'` $pids" | |
fi | |
echo $pids | |
cd content | |
rackup -s thin & pids="$pids $!" | |
rails server thin & pids="$pids $!" | |
trap "echo caught signal;kill -15 $pids;sleep 1;kill $pids; exit" 1 2 3 6 15 | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment