Shell practice: Use shell to implement the squid daemon process
Source: Internet
Author: User
Shell practice: use shell to implement squid daemon 01 use shell to implement squid daemon 02 check the squid service status every two minutes. if the squid service is no longer running, start it, scripts for daemon 03 are as follows: 04! Binsh05codebyscpman06mail: scpman @ shell practice: use shell to implement squid daemon 01 use shell to implement squid daemon 02 check the squid service status every two minutes. if the squid service is no longer running, start, scripts for daemon 03 are as follows: 04 #! /Bin/sh05 # code by scpman06 # mail: scpman@Live.com07 # Blog: http://www.scpman.com08msgip= "10.0.1.111" 09IP = 'cat/etc/rc. conf | grep-E "ifconfig _ [em1 | bce1]" | awk '{print "IP:" $2}' | sed-n 1 P' 10check _ squid () 11 {12rs_flag = 'PS uaxww | grep squid | grep-v grep | wc-l '13if ["$ rs_flag"-gt 0] 14then15 echo 'Squid server is running .. '16 exit; 17else18 echo 'squid server is not running... '19/usr/local/squid/sbin/squid-z20/usr/local/squid/sbin/squid-D21/usr/bin/logger-p local1.info-h $ msgip" the services: $ IP squid will to start by watch_squid.sh "22 sleep 123 check_squid24fi25} 26check_squid27 is implemented on a regular basis every two minutes, if it is *** 28, the following 29 */2 ***** su-root-c "/usr/home/admin/mgr_shell/watch_squid.sh"
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.