Squid 服务启动脚本

Squid 服务随系统启动,因搭建作为生产环境,所以还是作为系统服务启动,所以在网上找到一个代码简洁些,可以用的启动脚本。

squid 安装路径是/usr/local/squid

#!/bin/bash #
chkconfig: 345 61 61
# description: squid is a web cache server
# processname: squid
. /etc/rc.d/init.d/functions
case $1 in
"start") /usr/local/squid/sbin/squid -s
if [ $? == "0" ];then
echo "squid start ok"
else
echo "please check the log"
fi
;;
"stop") /usr/local/squid/sbin/squid -k shutdown
if [ $? == "0" ];then
echo "squid stop ok"
else
echo "please check the log"
fi
;;
"restart")
/usr/local/squid/sbin/squid -k shutdown
if [ $? == "0" ];then
/usr/local/squid/sbin/squid -s
if [ $? == "0" ];then
 echo "squid restart ok"
else
/usr/local/squid/sbin/squid -s
if [ $? == "0" ];then
 echo "squid restart ok"
else
echo "please check the log"
fi
fi
fi
;;
 *)
echo "Usage only start|stop|restart"
;;
esac

把这个文件放到/etc/init.d/目录下并命名为squid

chmod +x /etc/init.d/squid

chkconfig --add squid

如果出现squid 服务不支持 chkconfig

则去更改上面的  chkconfig: 345 61 61    这几个数字

配置Squid代理http和rsync

Squid:实现高速的Web访问

CentOS 6.2 编译安装Squid 配置反向代理服务器

简单配置Squid代理和反向代理

CentOS 6.4下DNS+Squid+Nginx+MySQL搭建高可用Web服务器

Squid 的详细介绍请点这里
Squid 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/adaaa02767efe80f2e386f9b50bdf0b1.html