Manage http service scripts

Source: Internet
Author: User

Because you always need to reinstall the system, you need to reset the http Service Startup Script again. This time, the script is backed up.

Httpd for Ubuntu

System: nginx + php-fpm

#! /Bin/sh ### begin init info # Provides: httpd # Required-Start: $ all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: run http server ### end init INFOexec_phpfpm = "/opt/php5/sbin/php-fpm" pid_phpfpm = "/run/php-fpm.pid" exec_nginx = "/opt/nginx/sbin/ nginx "pid_nginx ="/run/nginx. pid "# Stop the php-fpm service do_stop_phpfpm () {echo-n" Stoping php-fpm... "kill-QUIT 'cat $ {pid_phpfpm} '>/dev/n Ull 2> & 1 if [$? -Eq 0]; then show_success else show_failed fi echo "" }## output OKshow_success () {echo-n "\ 033 [32 m [OK] \ 033 [0 m" }## output NOshow_failed () {echo-n "\ 033 [37 m [NO] \ 033 [0 m" }## start the php-fpm service do_start_phpfpm () {echo-n "starting php-fpm... "$ exec_phpfpm-g $ pid_phpfpm>/dev/null 2> & 1 if [$? -Eq 0]; thenshow_success else echo-n "\ 033 [37 m [NO] \ 033 [0 m" fi echo "" }## nginx reload setting do_reload_nginx () {$ exec_nginx-s reload>/dev/null 2> & 1 echo "\ 033 [32 m nginx reload config successfully. \ 033 [0 m "}## start the nginx service do_start_nginx () {echo-n" Starting nginx... "$ exec_nginx>/dev/null 2> & 1 if [$? -Eq 0]; thenshow_success else show_failed fi echo} # Stop the nginx service do_stop_nginx () {echo-n "Stoping nginx... "$ exec_nginx-s stop>/dev/null 2> & 1if [$? -Eq 0]; thenshow_success else show_failed fi echo} case $1 instart) echo "starting httpd server... "do_start_phpfpmdo_start_nginx; stop_phpfpm) echo" stoping php-fpm server... "do_stop_phpfpm; stop_nginx) echo" stoping nginx server... "do_stop_nginx; start_nginx) echo" starting nginx server... "do_start_nginx; restart_nginx) echo" restart nginx server... "do_stop_nginxdo_start_nginx; restart_phpfpm) echo" restart php-fpm server... "do_stop_phpfpmdo_start_phpfpm; restart) echo" restart httpd server... "do_stop_phpfpmdo_stop_nginxdo_start_phpfpmdo_start_nginx; stop) echo" stop httpd server... "outputs; reload) echo" reload nginx config "do_reload_nginx; *) echo" USE: httpd start | restart | reload | stop | restart_phpfpm | stop_phpfpm | stop_nginx | start_nginx ";; esacexit 0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.