fastcgi init script on centos enhanced version

#!/bin/bash
#
# fcgi     Startup script for fcgi
#
# processname: fcgi

# Source function library
. /etc/rc.d/init.d/functions

## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/opt/app/lighttpd/bin/spawn-fcgi"

## ABSOLUTE path to the PHP binary
FCGIPROGRAM="/opt/app/php-cgi/bin/php-cgi"

## TCP port to which to bind on localhost
#FCGIPORT="1026"
FCGI_SOCKET="/tmp/php-fastcgi.sock"

FCGI_PIDFILE="/var/run/spawn-fcgi.pid"

## number of PHP children to spawn
PHP_FCGI_CHILDREN=20

## maximum number of requests a single PHP process can serve before it is restarted
PHP_FCGI_MAX_REQUESTS=500

## IP addresses from which PHP should access server connections
FCGI_WEB_SERVER_ADDRS="127.0.0.1"

# allowed environment variables, separated by spaces
ALLOWED_ENV="SHELL PATH USER"

## if this script is run as root, switch to the following user
USERID=rsync
GROUPID=daemon

################## no config below this line

if test x$PHP_FCGI_CHILDREN = x; then
  PHP_FCGI_CHILDREN=5
fi

export PHP_FCGI_MAX_REQUESTS
export FCGI_WEB_SERVER_ADDRS

ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"
if test x$UID = x0; then
  #EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN"
  EX="$SPAWNFCGI -s $FCGI_SOCKET -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE"
else
  #EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN"
  EX="$SPAWNFCGI -s $FCGI_SOCKET -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE"
fi

# copy the allowed environment variables
E=

for i in $ALLOWED_ENV; do
  E="$E $i=${!i}"
done

# clean the environment and set up a new one
#env - $E $EX

prog="fcgi" 

RETVAL=0

start() {
        echo -n $"Starting $prog: "
        daemon env - $E $EX
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        rm -f $FCGI_PIDFILE $FCGI_SOCKET
        killproc $FCGIPROGRAM
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        condrestart)
                if [ -f /var/lock/subsys/$prog ]; then
                        stop
                        start
                fi
                ;;
        status)
                status $FCGIPROGRAM
                RETVAL=$?
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart|condrestart|status}"
                RETVAL=1
esac

exit $RETVAL

On the / etc / init.d / below to facilitate

分类:Ruby 时间:2009-03-20 人气:757
分享到:
blog comments powered by Disqus

相关文章

  • java environment variables configuration summary 2010-03-29

    windows xp configure JDK environment variables: 1. Install JDK, the installation process you can customize the installation directory and other information, for example, we have chosen to install directory is D: \ java \ jdk1.5.0_08; 2. The installat

  • Environment variables file on linux 2010-10-21

    / Etc / profile: This file is the system of environmental information for each user setting, when the user first logs in, the file is executed. And from the / etc / profile.d directory to collect shell configuration file settings. / Etc / bashrc: bas

  • I used Linux command of the export - set or display environment variables 2011-08-02

    I used Linux command of the export - set or display environment variables This link: http://codingstandards.iteye.com/blog/1138524 (reproduced please indicate the source) Use Description export command can be used to set or display environment variab

  • ubuntu linux environment variables 2010-06-18

    Method 1: Modify / etc / profile file All users have the right to use shell environment variables <1> in the shell terminal execute the command: vi / etc / profile <2> end of the file in the profile by adding: JAVA_HOME = / usr/lib/jvm/java-6-

  • Ubuntu environment variables 2010-08-19

    Environment variable configuration file In Ubuntu, there are several files you can set the environment variable 1, / etc / profile: In the log, the operating system to use when customizing the user environment, the first file, the file system setting

  • In linux java virtual machine environment variables to configure 2011-08-05

    In linux java virtual machine environment variables to configure the steps: 1, using the "Text Editor" to open / etc / profile file 2, JAVA_HOME=/usr/tmp/jdk1.6.0_26 PATH=$JAVA_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tool

  • Ubuntu Configure JDK environment variables 2011-09-06

    First, the system comes with ubuntu "Synaptic Package" to download the latest version of the JDK, since JDK1.5 JDK1.6 is more stable than that, I chose to JDK1.5, download after installation, the installation when I use is installed to the defau

  • Small number of shell programming knowledge (shell common sense part) 2011-03-13

    Small number of shell programming knowledge (shell common sense part) Time :2006 -07-16 21:17:50 Source: Author: Reproduced: http://www.xxlinux.com/linux/article/development/shell/2006-07-16/2805.html First, users log into the system after the system

  • Terminal server has exceeded the maximum allowable number of connections --- solution [transfer] 2010-11-30

    Terminal server has exceeded the maximum allowable number of connections --- a total of four posts a solution, Hits: 11733 User: 222.212.199 .*** 2007-5-4 20:24:44 landlord] [back at the top of the list Server is installed in Windows 2003, I used the

  • Remote Desktop Connection win2003 system prompts the terminal server has exceeded the maximum allowable number of connections solution summary (reproduced) 2010-11-03

    Remote Desktop connection prompt Terminal server has exceeded the maximum allowable number of connections Solution Summary Frequently these days of remote login server, because there is no time off or other conditions in the morning when prompted aga

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.559 (s). 12 q(s)