rokkonet

PC・Androidソフトウェア・アプリの開発・使い方に関するメモ

Ruby-Sinatraをデーモン起動するシェルスクリプト

2020 Apr. 17.

#!/bin/sh -e

# 2020 Aug. 17.
# 2016 Feb. 09.

# Start Sinatra daemon.


cmdname=`basename $0`

if [ $# -gt 0 ]; then
  echo "Failed."
  echo "No arguement is required."
  echo "Usage: ${cmdname}"
  echo "  This script runs as below."
  echo "    Sets current directory to ${HOME}/sinatra"
  echo "    Runs sinatra-script."
  echo "      # bundle exec app.rb -e production"
  echo "    You can get your sinatra-application at http://HOST:4567/tv."
  exit 1
fi

cd ${HOME}/sinatra

bundle exec ruby ./app.rb -e production

exit 0