Skip to content

Instantly share code, notes, and snippets.

@wxianfeng
Created October 12, 2011 02:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wxianfeng/1280118 to your computer and use it in GitHub Desktop.
Save wxianfeng/1280118 to your computer and use it in GitHub Desktop.
About thin
root@SNDA-192-168-2-15:~# thin install
>> Installing thin service at /etc/init.d/thin ...
mkdir -p /etc/init.d
writing /etc/init.d/thin
chmod +x /etc/init.d/thin
mkdir -p /etc/thin
To configure thin to start at system boot:
on RedHat like systems:
sudo /sbin/chkconfig --level 345 thin on
on Debian-like systems (Ubuntu):
sudo /usr/sbin/update-rc.d -f thin defaults
on Gentoo:
sudo rc-update add thin default
Then put your config files in /etc/thin
root@SNDA-192-168-2-15:~# sudo /usr/sbin/update-rc.d -f thin defaults
update-rc.d: warning: thin stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (S 0 1 6)
Adding system startup for /etc/init.d/thin ...
/etc/rc0.d/K20thin -> ../init.d/thin
/etc/rc1.d/K20thin -> ../init.d/thin
/etc/rc6.d/K20thin -> ../init.d/thin
/etc/rc2.d/S20thin -> ../init.d/thin
/etc/rc3.d/S20thin -> ../init.d/thin
/etc/rc4.d/S20thin -> ../init.d/thin
/etc/rc5.d/S20thin -> ../init.d/thin
#!/bin/sh
PROJECT_PATH=/usr/local/system/projects/entos_dev
THIN_CONFIG=/usr/local/system/thin/thin.yml
BUNDLE_BIN=/home/entos/.rvm/gems/ruby-1.9.2-p290/bin/bundle
cd $PROJECT_PATH
case $1 in
"start" )
echo "start thin"
$BUNDLE_BIN exec thin start -C $THIN_CONFIG
;;
"stop" )
echo "stop thin"
$BUNDLE_BIN exec thin stop -C $THIN_CONFIG
;;
"restart thin" )
echo "restart thin"
$BUNDLE_BIN exec thin restart -C $THIN_CONFIG
;;
*)
echo "need start|stop|restart"
exit 1
esac
# generate thin config for Rails project
# more options,SEE
# thin -h
thin config -C /etc/thin/thin.yml -c /usr/local/system/www/wxianfeng_com/current -e production -p 3000 -d -O -s 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment