Compile the startup script

Source: Internet
Author: User
The startup scripts written before writing the startup script do not have any color. after studying functions, functions is a good startup script interface file. The most important functions are daemon and killproc2. So I wrote nginx #! /Bin/bash # chkconfig: 352334... the startup scripts written before writing the startup script do not have any color. after studying functions, functions is a good startup script interface file. The most important functions are daemon and killproc2. So I wrote nginx #! /Bin/bash # chkconfig: 35 23 34 # description: nginx webserver # set-x if [-f/etc/init. d/functions]; then. /etc/init. d/functions # load functions ,. here, it is equivalent to the source function fiprog = nginx # Service name, multiple calls of RETVAL = 0 # Status return value, the functions function calls nginx =/usr/local/nginx/sbin/nginxNGINX_CONF_FILE =/usr/local/nginx/conf/nginx. confpidfile =/usr/local/nginx/logs/nginx. pidlockfile =/var/lock/subsys/$ {prog} # files in the subsys directory are used to serve other programs. Start () {echo-n $ "Starting $ prog:" daemon $ nginx-c $ NGINX_CONF_FILE ### RETVAL =$? Echo [$ RETVAL-eq 0] & touch $ {lockfile} return $ RETVAL} stop () {echo-n $ "Stopping $ prog: "killproc-p $ {pidfile }### killproc obtains the pid from pidfile and kills it # RETVAL =$? Echo [$ RETVAL-eq 0] & amp;/bin/rm-f $ {lockfile} return $ RETVAL} case $1 in start) start; stop) stop; restart) stopstart; esac
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.