亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

php-fpm開(kāi)機(jī)自動(dòng)啟動(dòng)Shell腳本

 更新時(shí)間:2015年06月19日 10:38:21   投稿:junjie  
這篇文章主要介紹了php-fpm開(kāi)機(jī)自動(dòng)啟動(dòng)Shell腳本,本文腳本只是范例,其實(shí)你編譯安裝完成后,啟動(dòng)腳本已經(jīng)生成在編譯目錄中,只需要復(fù)制出來(lái)用就可以了,需要的朋友可以參考下

網(wǎng)上有各種版本的php-fpm開(kāi)機(jī)自動(dòng)啟動(dòng)腳本, 其實(shí)你編譯后源目錄已經(jīng)生成自動(dòng)腳本。不用做任何修改即用。

cp {php-5.3.x-source-dir}/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

php-fpm開(kāi)機(jī)自動(dòng)啟動(dòng)腳本如下:

#! /bin/sh
### BEGIN INIT INFO
# Provides:     php-fpm
# Required-Start:  $remote_fs $network
# Required-Stop:   $remote_fs $network
# Default-Start:   2 3 4 5
# Default-Stop:   0 1 6
# Short-Description: starts php-fpm
# Description:    starts the PHP FastCGI Process Manager daemon
### END INIT INFO
 
prefix=/usr/local/php
exec_prefix=${prefix}
 
php_fpm_BIN=${exec_prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid
 
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"
 
wait_for_pid () {
    try=0
 
    while test $try -lt 35 ; do
 
        case "$1" in
            'created')
            if [ -f "$2" ] ; then
                try=''
                break
            fi
            ;;
 
            'removed')
            if [ ! -f "$2" ] ; then
                try=''
                break
            fi
            ;;
        esac
 
        echo -n .
        try=`expr $try + 1`
        sleep 1
 
    done
 
}
 
case "$1" in
    start)
        echo -n "Starting php-fpm "
 
        $php_fpm_BIN --daemonize $php_opts
 
        if [ "$?" != 0 ] ; then
            echo " failed"
            exit 1
        fi
 
        wait_for_pid created $php_fpm_PID
 
        if [ -n "$try" ] ; then
            echo " failed"
            exit 1
        else
            echo " done"
        fi
    ;;
 
    stop)
        echo -n "Gracefully shutting down php-fpm "
 
        if [ ! -r $php_fpm_PID ] ; then
            echo "warning, no pid file found - php-fpm is not running ?"
            exit 1
        fi
 
        kill -QUIT `cat $php_fpm_PID`
 
        wait_for_pid removed $php_fpm_PID
 
        if [ -n "$try" ] ; then
            echo " failed. Use force-quit"
            exit 1
        else
            echo " done"
        fi
    ;;
 
    force-quit)
        echo -n "Terminating php-fpm "
 
        if [ ! -r $php_fpm_PID ] ; then
            echo "warning, no pid file found - php-fpm is not running ?"
            exit 1
        fi
 
        kill -TERM `cat $php_fpm_PID`
 
        wait_for_pid removed $php_fpm_PID
 
        if [ -n "$try" ] ; then
            echo " failed"
            exit 1
        else
            echo " done"
        fi
    ;;
 
    restart)
        $0 stop
        $0 start
    ;;
 
    reload)
 
        echo -n "Reload service php-fpm "
 
        if [ ! -r $php_fpm_PID ] ; then
            echo "warning, no pid file found - php-fpm is not running ?"
            exit 1
        fi
 
        kill -USR2 `cat $php_fpm_PID`
 
        echo " done"
    ;;
 
    *)
        echo "Usage: $0 {start|stop|force-quit|restart|reload}"
        exit 1
    ;;
 
esac

相關(guān)文章

  • 隱藏shell腳本內(nèi)容的工具?shc詳解

    隱藏shell腳本內(nèi)容的工具?shc詳解

    本文主要介紹了隱藏shell腳本內(nèi)容的工具?shc,?雖然它加密的安全性不高,但是我們平常可以把它作為一個(gè)shell腳本代碼隱藏和混淆工具來(lái)使用,對(duì)shell腳本隱藏相關(guān)知識(shí)感興趣的朋友一起看看吧
    2021-11-11
  • linux shell 中判斷文件、目錄是否存在的方法

    linux shell 中判斷文件、目錄是否存在的方法

    這篇文章主要介紹了linux shell 中判斷文件、目錄是否存在的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • Linux下一些常用的Shell腳本整理

    Linux下一些常用的Shell腳本整理

    這篇文章主要介紹了Linux下一些常用的Shell腳本整理,很基礎(chǔ),印象不深的話隨看隨記:)需要的朋友可以參考下
    2015-07-07
  • shell腳本批量刪除es索引的方法

    shell腳本批量刪除es索引的方法

    今天小編就為大家分享一篇關(guān)于shell腳本批量刪除es索引的方法,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2019-03-03
  • linux定時(shí)器crontab的使用教程

    linux定時(shí)器crontab的使用教程

    這篇文章主要介紹了linux定時(shí)器crontab的使用教程,需要的朋友可以參考下
    2018-08-08
  • Shell腳本批量清除Nginx緩存

    Shell腳本批量清除Nginx緩存

    這篇文章主要介紹了Shell腳本批量清除Nginx緩存,本文直接給出實(shí)現(xiàn)代碼和執(zhí)行效果圖,需要的朋友可以參考下
    2014-12-12
  • linux 中open()函數(shù)詳解及簡(jiǎn)單實(shí)例

    linux 中open()函數(shù)詳解及簡(jiǎn)單實(shí)例

    這篇文章主要介紹了linux 中open()函數(shù)詳解及簡(jiǎn)單實(shí)例的相關(guān)資料,需要的朋友可以參考下
    2017-04-04
  • shell 里面的奇葩字符實(shí)現(xiàn)

    shell 里面的奇葩字符實(shí)現(xiàn)

    這篇文章主要介紹了shell 里面的奇葩字符實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • shell腳本實(shí)現(xiàn)文件鎖功能

    shell腳本實(shí)現(xiàn)文件鎖功能

    這篇文章主要介紹了shell腳本實(shí)現(xiàn)文件鎖功能,本文實(shí)現(xiàn)了一個(gè)排它鎖,從而實(shí)現(xiàn)避免腳本重復(fù)執(zhí)行,需要的朋友可以參考下
    2014-12-12
  • Linux Shell腳本查看NUMA信息

    Linux Shell腳本查看NUMA信息

    這篇文章主要介紹了Linux Shell腳本查看NUMA信息,本文直接給出腳本實(shí)現(xiàn)代碼,需要的朋友可以參考下
    2015-06-06

最新評(píng)論