summaryrefslogtreecommitdiff
path: root/bin/web
diff options
context:
space:
mode:
Diffstat (limited to 'bin/web')
-rwxr-xr-xbin/web68
1 files changed, 13 insertions, 55 deletions
diff --git a/bin/web b/bin/web
index 06ff7c39296..f640abf0fbc 100755
--- a/bin/web
+++ b/bin/web
@@ -1,63 +1,21 @@
#!/bin/sh
+set -e
+
cd $(dirname $0)/..
app_root=$(pwd)
-# Switch to experimental PUMA configuration
-if [ -n "${EXPERIMENTAL_PUMA}" ]; then
- exec bin/web_puma "$@"
-fi
-
-unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
-unicorn_config="$app_root/config/unicorn.rb"
-unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV"
-
-get_unicorn_pid()
-{
- local pid=$(cat $unicorn_pidfile)
- if [ -z "$pid" ] ; then
- echo "Could not find a PID in $unicorn_pidfile"
- exit 1
- fi
- unicorn_pid=$pid
-}
-
-start()
-{
- exec $unicorn_cmd -D
-}
-
-start_foreground()
-{
- exec $unicorn_cmd
-}
-
-stop()
-{
- get_unicorn_pid
- kill -QUIT $unicorn_pid
-}
+case "$USE_WEB_SERVER" in
+ puma|"") # and the "" defines default
+ exec bin/web_puma "$@"
+ ;;
-reload()
-{
- get_unicorn_pid
- kill -USR2 $unicorn_pid
-}
+ unicorn)
+ exec bin/web_unicorn "$@"
+ ;;
-case "$1" in
- start)
- start
- ;;
- start_foreground)
- start_foreground
- ;;
- stop)
- stop
- ;;
- reload)
- reload
- ;;
- *)
- echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
- ;;
+ *)
+ echo "Unkown web server used by USE_WEB_SERVER: $USE_WEB_SERVER."
+ exit 1
+ ;;
esac