ユーザ用ツール

サイト用ツール


lang:rubyonrailsoncentos

config for Start Redbrick when boot os at CentOS

$ cat /etc/rc.d/init.d/redmine

#!/bin/sh 
# 
# Startup script for Redmine 
# 
# chkconfig: 345 80 15 
# description: redmine 
# processname: redmine 
# pidfile: /var/run/redmine.pid 
 
export PATH=/opt/ruby/bin:/usr/bin:bin 
 
# Source function library. 
. /etc/rc.d/init.d/functions 
 
# Source networking configuration. 
. /etc/sysconfig/network 
 
REDMINE_HOME=/opt/redmine-1.0.3 
REDMINE_USER=redmine 
 
[ -f $TOMCAT_SCRIPT ] || exit 0 
 
# See how we were called. 
case "$1" in 
    start) 
        # Start daemons. 
        if [ -f /var/lock/subsys/redmine ] ; then 
            echo "Redmine already started!" 
            exit 1 
        fi 
        echo "Starting Redmine:" 
        daemon --user $REDMINE_USER ruby $REDMINE_HOME/script/server webrick -e production -d 
        RETVAL=$? 
        echo 
        [ $RETVAL = 0 ] && touch /var/lock/subsys/redmine 
        ;; 
    stop) 
        # Stop daemons. 
        if [ ! -f /var/lock/subsys/redmine ] ; then 
            echo "Redmine already stopped!" 
            exit 1 
        fi 
        echo "Shutting down Redmine:" 
        PID=`netstat -lnp --tcp | grep "0\.0\.0\.0:3000" | awk '{print $7}' | sed -e 's/\/ruby//'` 
        kill -INT $PID 
        RETVAL=$? 
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/redmine /var/run/redmine.pid 
        ;; 
    status) 
        PID=`netstat -lnp --tcp | grep "0\.0\.0\.0:3000" | awk '{print $7}' | sed -e 's/\/ruby//'` 
        if [ -z $PID ]; then 
          echo "Redmine is stopped" 
        else 
          echo "Redmine is running" 
        fi 
        exit $? 
        ;; 
    restart) 
        $0 stop 
        sleep 7 
        $0 start 
        ;; 
    *) 
        echo "Usage: $REDMINE_PROG {start|stop|status|restart}" 
        exit 1 
esac 
 
exit 0 
lang/rubyonrailsoncentos.txt · 最終更新: 2016/01/27 09:47 (外部編集)