Redmine开启服务

写了一个启动Redmine的开机脚本,redmine文件在/etc/init.d/下

#!/bin/sh

### BEGIN INIT INFO
# Provides:     Dean Chen
# Required-Start:
# Required-Stop:
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description: redmine
# Description: Redmine+Backlogs server
### END INIT INFO

. /lib/lsb/init-functions

SPAWN_FCGI=/usr/bin/spawn-fcgi

case "$1" in
  start)
     log_begin_msg "Starting redmine server"
     $SPAWN_FCGI -p 9001 -f /root/redmine-2.3/public/dispatch.fcgi
     log_end_msg 0
     ;;
  stop)
     PID=`ps -ef | grep 'fcgi' | grep -v grep | awk '{print $2}'`
     log_begin_msg "Stopping redmine server"
     if [ ! -z "$PID" ]; then
        kill -15 $PID
     fi
     log_end_msg 0
     ;;
  restart)
     $0 stop
     $0 start
     ;;
  *)
     log_success_msg "Usage: service redmine {start|stop|restart}"
     exit 1
esac

exit 0

确保系统设置了redmine用户,并且把redmine的代码安装在/home/redmine/目录下,那么上面的启动脚本可以指定用redmine用户启动进程,改一句:

$SPAWN_FCGI -u redmine -p 9001 -f /home/redmine/redmine-2.4.2/public/dispatch.fcgi


你可能感兴趣的:(Redmine开启服务)