常常在更改LNMP配置之后,需要重启LNMP,在此写了一个自动化脚本,方便重启LNMP。 除了方便重新启动,还增加了关闭与开启功能。 Operating System: Ubuntu Server 代码

# !/bin/bash
function start(){ sudo service nginx start sudo service php5-fpm start } 
function startall(){ start sudo service mysql start }
function stop(){ sudo service nginx stop sudo service php5-fpm stop } 
function stopall(){ stop sudo service mysql start } 
function restart(){ sudo service nginx restart sudo service php5-fpm restart } 
function restartall(){ restart sudo service mysql restart }

## main()

case "$1" in 
    "start") start ;; 
    "startall") startall ;; 
    "stop") stop ;; 
    "stopall") stopall ;; 
    "restart") restart ;; 
    "restartall") restartall ;; 
    "configtest") configtest ;; 
*) echo "Usage: $0 {start|stop|restart|startall|stopall|restartall}" 

esac exit 0 

webserver restart //重启nginx 和 php-fpm


电子邮件地址不会被公开。 必填项已用*标注

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax