Skip to content

Instantly share code, notes, and snippets.

@ylluminate
Created February 25, 2012 20:10
Show Gist options
  • Save ylluminate/2bbf81f54265672723e1 to your computer and use it in GitHub Desktop.
Save ylluminate/2bbf81f54265672723e1 to your computer and use it in GitHub Desktop.
#!/bin/sh
# PROVIDE: chiliproject
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf[.local] to enable chiliproject
#
# chiliproject_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable redmine.
# chiliproject_flags (str): Custom additional arguments to be passed
# to redmine.
# chiliproject_user (str): User account to run thin with. (default: www)
# chiliproject_group (str): Group to run thin with. (default: www)
. /etc/rc.subr
name="chiliproject"
rcvar=`set_rcvar`
command=/usr/local/rvm/bin/ruby
pidfile="/usr/local/www/chiliproject/tmp/pids/thin.pid"
load_rc_config $name
# set defaults
: ${chiliproject_enable="NO"}
: ${chiliproject_flags="-a 0.0.0.0 -p 3000 -e production"}
: ${chiliproject_user="www"}
: ${chiliproject_group="www"}
current_working_dir=`pwd`
cd /usr/local/www/chiliproject
command_args="-d -D -c /usr/local/www/chiliproject -u ${chiliproject_user} -g ${chiliproject_group}"
start_cmd="RAILS_ENV=production /usr/local/rvm/gems/ruby-1.9.3-p125@all/bin/bundle exec /usr/local/rvm/gems/ruby-1.9.3-p125@all/bin/thin ${command_args} ${chiliproject_flags} start"
echo $start_cmd
run_rc_command "$1"
cd $current_working_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment