Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SQUID Service (2) "script"

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

"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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report