diff options
author | maxwell <maxwell@joindiaspora.com> | 2010-12-21 05:11:50 +0300 |
---|---|---|
committer | maxwell <maxwell@joindiaspora.com> | 2010-12-21 05:12:12 +0300 |
commit | 081e85f224eb5d4a16c56bc7fc59f7faf5d256ab (patch) | |
tree | 50a5518500c671f0ea4c61345b44c53659a88209 /script | |
parent | 6d4696faf0d3b1c16c5441e9d1d27ba9adb9f436 (diff) |
Revert "Extended sub-uri support." for now....
This reverts commit 9cd08bac67e268f6c0a0361c2bcaeb41b03055c9.
Diffstat (limited to 'script')
-rwxr-xr-x | script/get_env.sh | 23 | ||||
-rwxr-xr-x | script/server | 21 |
2 files changed, 12 insertions, 32 deletions
diff --git a/script/get_env.sh b/script/get_env.sh deleted file mode 100755 index 44e77e491..000000000 --- a/script/get_env.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Get value from APP_CONFIG -# -# Usage get_env [key ...] - -path=$( readlink -fn $0) && cd $(dirname $path)/.. || exit 2 - -if [[ ! -e tmp/environment || tmp/environment -ot config/app_config.yml ]] -then - ruby > tmp/environment << 'EOT' - require File.join('config', 'environment.rb') - APP_CONFIG.each { |key, value| puts key.to_s + "\t" + value.to_s } - puts "pod_uri.host\t" + APP_CONFIG[:pod_uri].host.to_s - puts "pod_uri.path\t" + APP_CONFIG[:pod_uri].path.to_s - puts "pod_uri.port\t" + APP_CONFIG[:pod_uri].port.to_s -EOT -fi - -for key in $@; do - awk -v key=$key '{ if ($1 == key ) print $2 }' < tmp/environment -done - diff --git a/script/server b/script/server index dcc3d457e..b20e0d59c 100755 --- a/script/server +++ b/script/server @@ -12,17 +12,12 @@ OS=`uname -s` function init_public # Create all dynamically generated files in public/ folder { - sub_uri=$(./script/get_env.sh pod_uri.path) - if [ -n "$sub_uri" ]; then - cd public; ln -sf . ${sub_uri##/}; cd .. - fi bundle exec thin \ -d --pid log/thin.pid --address localhost --port $THIN_PORT \ start - pod_url=$(./script/get_env.sh pod_url) for ((i = 0; i < 30; i += 1)) do sleep 2 - wget -q -O tmp/server.html "$pod_url" && \ + wget -q -O tmp/server.html http://localhost:$THIN_PORT && \ rm tmp/server.html && break done bundle exec thin --pid log/thin.pid stop @@ -80,8 +75,14 @@ function redis_config config/redis.conf } -THIN_PORT=$(./script/get_env.sh 'pod_uri.port') -SOCKET_PORT=$(./script/get_env.sh 'socket_port') +# Scan for -p, find out what port thin is about to use. +args="$DEFAULT_THIN_ARGS $@" +prev_arg='' +for arg in $( echo $args | awk '{ for (i = 1; i <= NF; i++) print $i}') +do + [ "$prev_arg" = '-p' ] && THIN_PORT="$arg" + prev_arg="$arg" +done # Is someone listening on the ports already? (ipv4 only test ?) services=$( chk_service $THIN_PORT ) @@ -106,6 +107,8 @@ if [ -n "$services" ]; then exit 64 fi + + # Check if Mongo is running if ! ps ax | grep -v grep | grep mongod >/dev/null then @@ -142,4 +145,4 @@ mkdir -p -v log/thin/ bundle exec ruby ./script/websocket_server.rb& redis-server config/redis.conf &>log/redis-console.log & QUEUE=* bundle exec rake resque:work& -bundle exec thin start -p $THIN_PORT $@ +bundle exec thin start $args |