Skip to content

Instantly share code, notes, and snippets.

@mapopa
Created October 24, 2012 09:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mapopa/3944992 to your computer and use it in GitHub Desktop.
Save mapopa/3944992 to your computer and use it in GitHub Desktop.
start thin in user rvm with env , solves /usr/bin/env: ruby_noexec_wrapper: No such file or directory
#!/bin/sh
### BEGIN INIT INFO
# Provides: thin
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: thin initscript
# Description: thin
### END INIT INFO
# Original author: Forrest Robertson
# Do NOT "set -e"
DAEMON=/home/ubuntu/.rvm/gems/ruby-1.9.3-p286/bin/thin
SCRIPT_NAME=/etc/init.d/thin
CONFIG_PATH=/etc/thin
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
sudo su -c "source /home/ubuntu/.rvm/environments/default ; $DAEMON start --all $CONFIG_PATH" ubuntu
;;
stop)
sudo su -c "source /home/ubuntu/.rvm/environments/default; $DAEMON stop --all $CONFIG_PATH" ubuntu
;;
restart)
sudo su -c "source /home/ubuntu/.rvm/environments/default; $DAEMON restart --all $CONFIG_PATH" ubuntu
;;
*)
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
exit 3
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment