public
Description: Run rails applications reliably as runit services
Homepage: http://www.sanityinc.com/
Clone URL: git://github.com/purcell/rails-runit.git
Click here to lend your support to: rails-runit and make a donation at www.pledgie.com !
rails-runit / thin-run
100755 24 lines (18 sloc) 0.451 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh -e
 
PORT=$(basename $(pwd)|awk -F- '{print $2}')
BASE=$(dirname $(readlink $0))
APP_DIR=$($BASE/readlink_canonical $BASE/app)
 
if [ -e $BASE/thin ]; then
THIN=$BASE/thin
else
THIN=thin
fi
 
if [ -z "$PORT" ]; then
echo "usage: $0 port" 1>&2;
  exit 2
fi
 
if [ ! -d "$APP_DIR" ]; then
echo "no such app dir: $APP_DIR (did you create a symlink to your Rails app?)" 1>&2;
  exit 2
fi
 
exec $THIN start -e production -p $PORT -c $APP_DIR