Skip to content

Instantly share code, notes, and snippets.

@do-aki
Created July 3, 2012 07:49
Show Gist options
  • Save do-aki/3038337 to your computer and use it in GitHub Desktop.
Save do-aki/3038337 to your computer and use it in GitHub Desktop.
redmine 起動スクリプト
#!/bin/sh
export HOME=/home/redmine
SHELL="$HOME/.rvm/bin/rvm-shell 1.9.3"
PID_FILE=$HOME/redmine.pid
LISTEN='127.0.0.1:3001'
APP_DIR=$HOME/redmine-2.0
start() {
cd $APP_DIR && $SHELL -c "unicorn --listen $LISTEN --pid=$PID_FILE --env=production --daemonize"
}
stop() {
if [ -s $PID_FILE ]; then
kill -QUIT `cat $PID_FILE`
fi
}
force_stop() {
if [ -s $PID_FILE ]; then
kill -TERM `cat $PID_FILE`
fi
}
reload() {
if [ -s $PID_FILE ]; then
kill -HUP `cat $PID_FILE`
fi
}
status() {
if [ -s $PID_FILE ]; then
echo running
else
echo stoped
fi
}
usage() {
echo "Usage: `basename $0` {start|stop|force-stop|reload}"
}
case $1 in
start)
start
;;
stop)
stop
;;
force-stop)
force_stop
;;
reload)
reload
;;
status)
status
;;
*)
usage
RETVAL=255
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment