Disable the service by connecting to the network in unbuntu

Source: Internet
Author: User

Disable the service through network connection in unbuntu #! /Bin/bash # specify ip address = 192.168.1.1 # specify the crm directory CRMDIR =/home/huchy/crm-ehr-20120522-deploy/# specify the user's password www.2cto.com PASSWORD_USER = 123456 # define flagPing = 0 flagStart = 0 flagMysql = 0 flagMemcached = 0 # Set the ping timeout value, query results, if a correct response is received, it indicates location 1 for line in 'Ping-c2-w 10 $ IP | grep "64 bytes from $ ip" 'Do flagPing = 1 done # view crm Service enabled or not, once started, set the flag to 1 for line in 'pstree | grep "java" 'Do flagStart = 1 done # Check whether the mysql service has been started, once started, set the flag to 1 for line in 'pstree | grep "mysql" 'Do flagMysql = 1 done # Check whether the memcached service is started with memcached, once started, set the flag to 1 for line in 'pstree | grep "memcached-d" 'Do flagMemcached = 1 done www.2cto.com echo "*********** * ************************** "echo" $ {flagPing} "echo" $ {flagStart} "echo" $ {flagMysql} "echo" $ {flagMemcached} "echo "********************* * ***************** "# If the flag bit is 1, it is normal operation, 0 indicates a network failure. if [$ flagPing = 0] then echo "$ IP failed" if [$ flagStart = 1] then cd $ {CRMDIR }. /stopofbiz. sh fi if [$ flagMysql = 1] then echo $ PASSWORD_USER | sudo-S service mysql stop fi echo $ PASSWORD_USER | sudo-S kill-9 'ps-ef | grep memcached | grep-v "grep" | awk '{print $2} ''else echo" $ IP success "if [$ flagMysql = 0] then echo $ PASSWORD_USER | sudo-S service mysql start fi if [$ flagStart = 0] then www.2cto.com cd $ {CRMDIR }. /startofbiz. sh fi if [$ flagMemcached = 0] then echo $ PASSWORD_USER | sudo-S service memcached stop memcached-d fi # echo $ PASSWORD_USER | sudo-S service mysql start # echo $ PASSWORD_USER | sudo-S service memcached stop # pingshizhe by memcached-d

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.