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 #! /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"