#!/bin/sh set -e export RAILS_ENV=development stop() { echo "Stopping ..." ./script/delayed_job stop ./script/feed-updater stop whenever --clear-crontab if [ -f tmp/pids/unicorn.pid ]; then kill -9 $(cat tmp/pids/unicorn.pid) rm -f tmp/pids/unicorn.pid fi exit } start() { rake db:abort_if_pending_migrations ./script/feed-updater start ./script/delayed_job start trap stop INT TERM EXIT whenever --write-crontab --set 'environment=development' if [ -z "$RAILS_RELATIVE_URL_ROOT" ]; then unicorn_rails --config-file lib/noosfero/unicorn.rb $@ else mkdir -p log touch log/development.log unicorn_rails \ --path "$RAILS_RELATIVE_URL_ROOT" \ --config-file lib/noosfero/unicorn.rb \ --daemonize tail -n 0 -f log/development.log || true fi } start $@