How Linux adds services for system services to start or close quickly

Source: Internet
Author: User
Tags clear screen set background

When the Linux system installed some services such as apache,mysql,iptables and so on to want to quickly start or restart, but in the use of system startup or shutdown services when the input command >service httpd Restart is not working. Add the current HTTPD service as a system service, how to add the current system service for system services cd/etc/init.d/ls such as CP network HTTPD Copy the current Network service script renamed to HTTPDVI/ ETC/INIT.D/HTTPD Copy the following code to saveCase "$" in
Start
echo $ "Bieanju Notice:apache now is starting ..."
/bin/systemctl Start Httpd.service
ECHO-E $ "Bieanju Notice:start is \033[32m[ok]\033[0m";;
Stop
echo $ "Bieanju notice:iptabels now Stop"
/bin/systemctl Stop Httpd.service
ECHO-E $ "Bieanju notice:stop is OK";;
Restart
echo $ "Bieanju Notice:iptabels is restarting"
/bin/systemctl Restart Httpd.service
echo $ "Bieanju Notice:restart is OK";;
Esac
ExitThe shell script code interprets the record by judging the input instruction Start,stop,restart to perform the corresponding operation and outputting the prompt echo-e can output the content with color display above set to the font green # Small note echo using the parameter number color: 30-–37
Word background color range: 40-–47
\33[0m Close All properties \33[1m set high brightness \33[4m underline \33[5m blink \33[7m reverse \33[8m fade \33[30m-\33[37m set foreground color \33[40m-\33[47   M set background color \33[na cursor up n line \33[NB cursor down n line \33[NC cursor right shift n row \33[nd cursor left n line \33[y;xh set cursor position \33[2j Clear screen \33[k clears contents from cursor to end of line \33[s Save cursor position \33[u restore cursor position \33[?25l Hide cursor \33[?25h display cursor
That's it. Service httpd Restart finally basically learned that we do a lamp environment restart, shut down the system service commandCase "$" in
Start
ECHO-E $ "Bieanju Notice: \033[32mapache\033[0m now is starting ..."
/bin/systemctl Start Httpd.service
ECHO-E $ "Bieanju Notice: \033[32mapache\033[0m is \033[32m[ok]\033[0m"
ECHO-E $ "Bieanju Notice: \033[32mmysql\033[0m now is starting ..."
/bin/systemctl Start Mysqld.service
ECHO-E $ "Bieanju Notice: \033[32mmysql\033[0m is \033[32m[ok]\033[0m";;
Stop
ECHO-E $ "Bieanju Notice: \033[32mapache\033[0m now is stopping ..."
/bin/systemctl Stop Httpd.service
ECHO-E $ "Bieanju Notice: \033[32mapache\033[0m Stop is \033[32m[ok]\033[0m"
ECHO-E $ "Bieanju Notice: \033[32mmysql\033[0m now is stopping ..."
/bin/systemctl Stop Mysqld.service
ECHO-E $ "Bieanju Notice: \033[32mmysql\033[0m Stop is \033[32m[ok]\033[0m";
Restart
ECHO-E $ "Bieanju Notice: \033[32mapache\033[0m now is restarting ..."
/bin/systemctl Restart Httpd.service
ECHO-E $ "Bieanju Notice: \033[32mapache\033[0m restartting is \033[32m[ok]\033[0m"
ECHO-E $ "Bieanju Notice: \033[32mmysql\033[0m now is restarting ..."
/bin/systemctl Restart Mysqld.service
ECHO-E $ "Bieanju Notice: \033[32mmysql\033[0m restartting is \033[32m[ok]\033[0m";
Esac
Exito Ashton Hair k

How Linux adds services for system services to start or close quickly

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.