diff options
author | MrZYX <pr0fkill@gmail.com> | 2011-01-22 19:55:10 +0300 |
---|---|---|
committer | MrZYX <pr0fkill@gmail.com> | 2011-01-22 19:55:10 +0300 |
commit | 7ba38d80f1b9912a0931be00c020d94f5fe5d1e1 (patch) | |
tree | 99ad9e7182376dd06ff6cf0c8526a9482160cacf /script | |
parent | cadcc3e7c3a5de945533a52fedbff9fe66fc1546 (diff) |
some untested improvments to script/server
Diffstat (limited to 'script')
-rwxr-xr-x | script/server | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/script/server b/script/server index 58576b4d6..158f898f0 100755 --- a/script/server +++ b/script/server @@ -7,8 +7,10 @@ realpath=$( ruby -e "puts File.expand_path(\"$0\")") cd $( dirname $realpath)/.. OS=`uname -s` + [ -e config/server.sh ] && source config/server.sh + function init_public # Create all dynamically generated files in public/ folder { @@ -20,7 +22,12 @@ function init_public wget -q -O tmp/server.html http://localhost:$THIN_PORT && \ rm tmp/server.html && break done - bundle exec thin --pid log/thin.pid stop + if [ -e 'log/thin.pid' ]; then + bundle exec thin --pid log/thin.pid stop + else + echo "Warning: Something is wrong in your installation, thin didn't come up for the first time initialization!" >&2 + echo "Try starting it manually with bundle exec thin start and look at the output." >&2 + fi if [ -e tmp/server.html ]; then echo "Cannot get index.html from web server (aborted)" >&2 return 2 @@ -28,6 +35,7 @@ function init_public bundle exec jammit } + function chk_service { port=${1:?Missing port} @@ -43,6 +51,7 @@ function chk_service esac } + function redis_config # Create/update the local redis.conf file from /etc master { @@ -75,6 +84,7 @@ function redis_config config/redis.conf } + # Scan for -p, find out what port thin is about to use. args="$DEFAULT_THIN_ARGS $@" prev_arg='' @@ -84,6 +94,7 @@ do prev_arg="$arg" done + # Is someone listening on the ports already? (ipv4 only test ?) services=$( chk_service $THIN_PORT ) if [ -n "$services" ]; then @@ -110,6 +121,7 @@ fi redis_config + # Force AGPL if [ -w public -a ! -e public/source.tar.gz ]; then branch=$( git branch | awk '/^[*]/ {print $2}') @@ -120,6 +132,19 @@ if [ ! -e public/source.tar.gz ]; then exit 65 fi + +# Check if config files exists +if [ ! -e 'config/app_config.yml' ]; then + echo "config/app_config.yml is missing! Copy over config/app_config.yml.example to config/app_config.yml and edit it properly!" >&2 + exit 67 +fi + +if [ ! -e 'config/database.yml' ]; then + echo 'config/database.yml is missing! Copy over config/database.yml.example to config/database.yml and edit it properly!' >&2 + exit 68 +fi + + # Precache jammit assets if [[ -w public && ! -e 'public/stylesheets/application.css' ]]; then if [ "$INIT_PUBLIC" != 'no' ]; then @@ -127,6 +152,7 @@ if [[ -w public && ! -e 'public/stylesheets/application.css' ]]; then init_public fi fi + if [ ! -e 'public/stylesheets/application.css' ]; then echo 'Jammit precache error (now or at install)' >&2 exit 66 |