วันจันทร์ที่ 13 กันยายน พ.ศ. 2553

clear squid อัตโนมัติ...

สร้างไฟล์ /usr/local/sbin/clear-squid-cache.sh
#!/bin/sh
#clear squid cache script
/usr/local/etc/rc.d/squid stop
/bin/sleep 10
rm -rf /var/cache/*
/bin/sleep 10
/usr/local/sbin/squid -z
/bin/sleep 10
/usr/local/etc/rc.d/squid start



กำหนดโหมดไฟล์
# chmod 755 /usr/local/sbin/clear-squid-cache.sh



การกำหนดเวลาการทำ log rotate แก้ไขไฟล์ /etc/crontab
0 0 * * * root /usr/local/sbin/squid -k rotate -f /usr/local/etc/squid/squid.conf
0 0 * * 0 root /usr/local/sbin/clear-squid-cache.sh

คำสั่งแรกจะทำการ rotate logfile ของ squid ทุกวัน
คำสั่งที่สองจะทำการเคลียร์ cache ของ squid ทุกสัปดาห์

ขอบคุณ คุณพรหมมาศ

ไม่มีความคิดเห็น: