Removing Squid proxy cache server automatic
Removing Squid proxy cache is automatically
If you want to delete the Squid proxy cache automatically following steps:
1. Create sebuat script that will be used to examine and remove the Squid proxy cache is automatically
# touch /root/clear-cache-squid.sh
# vim /root/clear-cache-squid.sh
Enter the following code, which in the following code settings of the 80GB HDD
squid proxy, squid cache directory is at / cache and the script will be placed in the / root
==================================================================
#!/bin/bash
#!/bin/bash
# direktori cache proxy
CACHEDIR=/cache
# kapasitas direktori cache proxy (80GB)
CACHEDIRSIZE=85899345920
ONEMB=1048576
ONEGB=1073741824
COUNTMB=`expr $CACHEDIRSIZE / $ONEMB`
COUNTGB=`expr $CACHEDIRSIZE / $ONEGB`
COUNTALOC=`expr $CACHEDIRSIZE / $ONEMB`
# mendapatkan besaran direktori cache saat ini
SIZE=`du -bc $CACHEDIR | grep total | awk '{print $1}'`
SIZEM=`du -bch $CACHEDIR | grep total | awk '{print $1}'`
# jika besaran direktori cache saat ini sama atau lebih besar dari
# kapasitas direktori cache proxy maka hapus cache proxy
if [ $SIZE -ge $CACHEDIRSIZE ]
then
/usr/bin/clear
echo "=================================="
echo "=== Generate Clear Cache Squid ==="
echo "=================================="
echo "Cahce Squid Proxy :" $CACHEDIR
echo "Jumlah cache tersimpan :" $SIZE Byte / $SIZEM
echo "Batas maximum cache :" $CACHEDIRSIZE Byte / $COUNTALOC MB
echo " * Clear cache squid in proccess ..."
sleep 10
/etc/init.d/squid stop # stop service squid
rm -fdR $CACHEDIR/* # hapus cache proxy
squid -z # membuat cache direktori
/etc/init.d/squid start # start service squid
/usr/bin/clear
echo "===================================="
echo "=== Clear Cache Squid Success !! ==="
echo "=== http://www.backlinux.com ==="
echo "===================================="
else
/usr/bin/clear
echo "================================================"
echo "=== Status Directory Cache Squid Proxy [OK] ==="
echo "=== http://www.backlinux.com ==="
echo "================================================"
echo "Cahce directory squid :" $SIZE Byte / $SIZEM
echo "Alokasi cahce squid :" $CACHEDIRSIZE Byte / $COUNTMB MB / $COUNTGB GB
fi
==============================================================================
Give access rights so that the script clear-cache-squid.sh can run
# chmod ug+x /root/clear-cache-squid.sh
Once you have created the file it is time to put on your system cronjob, so that the script can run automatically every day at midnight.
Edit cronjob
# crontab -e
Enter the code below cronjob
0 0 * * * /root/clear-cache-squid.sh
Friday, 27 March 2015
Removing Squid proxy cache server automatic
Posted By: Rufaidah-network - 22:52About Rufaidah-network
Techism is an online Publication that complies Bizarre, Odd, Strange, Out of box facts about the stuff going around in the world which you may find hard to believe and understand. The Main Purpose of this site is to bring reality with a taste of entertainment
Subscribe to:
Post Comments (Atom)
Popular
Tags
Videos
0 komentar:
Post a Comment