How to customize service scripts and how to make standard RPM service scripts

Source: Internet
Author: User

    • Custom Service Scripts:
#!/bin/bash#myscript#chkconfig: 2345#description: Starts, stops and saves Iptables firewall Case  $ inchStartEcho "Start my script!!"Sleep1;; RestartEcho "Restart my script!!"Sleep1;; StopEcho "Stop My script!!"Sleep1;; *)Echo "Please input start|restart|stop"Sleep1;;Esac
这样还不能使用chkconfig来管理,需要添加一下代码   #chkconfig: 2345 90 20        在2345级别下,  开机执行顺序是90, 关机执行顺序是20    #description:  Starts, stops and saves iptables firewall   添加完后执行:   chkconfig myscript on   chkconfig --list myscript
    • Transform the service script into a standard RPM script:
      #chkconfig: 2345 90 20
      At level 2,345, the boot execution sequence is 90, and the shutdown execution sequence is 20.
      #description: Starts, stops and saves Iptables firewall

    • To turn a custom script on and off via the service:
      Service MyScript Start|stop|restart

    • Set up the custom script to boot by chkconfig:
      Chkconfig MyScript on
      Chkconfig MyScript off

How to customize service scripts and how to make standard RPM service scripts

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.