SQUID Service (2) "script"
"1"
In order to make SQUID services start, stop, restart and other operations more convenient, you can write SQUID service scripts and use CHKCONFIG and SERVICE tools to manage.
"2"
The script reads as follows:
#! / bin/bash
# chkconfig: 2345 90 25
# config: / etc/squid.conf
# pidfile: / usr/local/squid/var/run/squid.pid
# Description: Squid-Internet Object Cache.
PID= "/ usr/local/squid/var/run/squid.pid"
CONF= "/ etc/squid.conf"
CMD= "/ usr/local/squid/sbin/squid"
Case "$1" in
Start)
Netstat-anpt | grep squid & > / dev/null
If [$?-eq 0]
Then
Echo "squid is running"
Else
Echo "starting squid."
$CMD
Fi
Stop)
$CMD-k kill & > / dev/null
Rm-rf $PID & > / dev/null
Status)
[- f $PID] & > / dev/null
If [$?-eq 0]
Then
Netstat-anpt | grep squid
Else
Echo "Squid is not running"
Fi
Restart)
$0 stop & > / dev/null
Echo "shutting down squid."
$0 start & > / dev/null
Echo "starting squid."
Reload)
$CMD-k reconfigure
Check)
$CMD-k parse
*)
Echo "usage: $0 {start | stop | restart | check | status}"
Esac
# Press: wq save exit
"3"
Return to the terminal and do the following:
Chmod + x / etc/init.d/squid
Chkconfig-add squid
Chkconfig squid on
thus. You can use the SQUID script to start, stop, restart, and reload the SQUID server by adding the appropriate start,stop,restart,reload parameters during execution.