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
Limit Youtube di Mikrotik Menggunakan Layer7 Protocol
Posted By: Rufaidah-network - 22:51
Limit Youtube di Mikrotik Menggunakan Layer7 Protocol
Melimit dengan Layer 7 protocol
/ip firewall layer7-protocol add comment="" name=http-video regexp= \ "http/(0\\.9|1\\.0|1\\.1)[\\x09-\\x0d ][1-5][0-9][0-9][\\x09-\\x0d -~]*(content-type: video)"
dan tuntuk firewal mangele
/ip firewall mangle add action=mark-connection chain=forward comment="batasi download" connection-bytes=1024000-4294967295 disabled=no \ in-interface=Wan new-connection-mark=download_con passthrough=yes
/ip firewall mangle add action=mark-packet chain=forward comment="" connection-mark=download_con disabled=no in-interface=Wan \ new-packet-mark=download_pkt passthrough=yes
/ip firewall mangle add action=mark-packet chain=prerouting comment="limit video streaming" disabled=no layer7-protocol=http-video \ new-packet-mark=http-video-up passthrough=yes protocol=tcp
/ip firewall mangle add action=mark-packet chain=prerouting comment="limit audio streaming" disabled=no layer7-protocol=http-audio \ new-packet-mark=http-audio-up passthrough=yes protocol=tcp
dan untuk queue type adalah salah satu feature dari MikroTik untuk membantu memanage traffic rate dan traffic packet, disini saya mencoba menuliskan catatan kecil mengenai perhitungan
classifier dst.address dan dst.port atau yg lebih di kenal memanage traffic download
/queue type
/queue type add kind=pcq name=batasidownload pcq-classifier=dst-address pcq-limit=50 pcq-rate=256000 pcq-total-limit=2000
Penjelasan Queue Simple : merupakan cara termudah untuk melakukan management bandwidth yang diterapkan pada jaringan skala kecil sampai menengah untuk mengatur pemakaian bandwidth upload dan download tiap user.
/queue simple add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 \ interface=all limit-at=0/8k max-limit=128k/128k name="HTTP Video Traffict" packet-marks=http-video-up parent=none \ priority=8 queue=default-small/default-small total-queue=default-small
/queue simple add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 \ interface=all limit-at=0/0 max-limit=128k/128k name="Queue HTTP Video" packet-marks=http-video-up parent= \ "HTTP Video Traffict" priority=8 queue=default-small/default-small target-addresses=0.0.0.0/0 total-queue= \ default-small
Queue Tree : mirip seperti queue simple tapi lebih rumit, yaitu dapat melakukan pembatasan bandwidth berdasarkan group bahkan secara hierarki. Kita harus mengaktifkan fitur Mangle pada Firewall jika ingin menggunakan Queue Tree
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=256k name=batasidownloadfreebrowsing \ packet-mark=download_pkt parent=global-out priority=8 queue=batasidownload
Melimit dengan Layer 7 protocol
/ip firewall layer7-protocol add comment="" name=http-video regexp= \ "http/(0\\.9|1\\.0|1\\.1)[\\x09-\\x0d ][1-5][0-9][0-9][\\x09-\\x0d -~]*(content-type: video)"
dan tuntuk firewal mangele
/ip firewall mangle add action=mark-connection chain=forward comment="batasi download" connection-bytes=1024000-4294967295 disabled=no \ in-interface=Wan new-connection-mark=download_con passthrough=yes
/ip firewall mangle add action=mark-packet chain=forward comment="" connection-mark=download_con disabled=no in-interface=Wan \ new-packet-mark=download_pkt passthrough=yes
/ip firewall mangle add action=mark-packet chain=prerouting comment="limit video streaming" disabled=no layer7-protocol=http-video \ new-packet-mark=http-video-up passthrough=yes protocol=tcp
/ip firewall mangle add action=mark-packet chain=prerouting comment="limit audio streaming" disabled=no layer7-protocol=http-audio \ new-packet-mark=http-audio-up passthrough=yes protocol=tcp
dan untuk queue type adalah salah satu feature dari MikroTik untuk membantu memanage traffic rate dan traffic packet, disini saya mencoba menuliskan catatan kecil mengenai perhitungan
classifier dst.address dan dst.port atau yg lebih di kenal memanage traffic download
/queue type
/queue type add kind=pcq name=batasidownload pcq-classifier=dst-address pcq-limit=50 pcq-rate=256000 pcq-total-limit=2000
Penjelasan Queue Simple : merupakan cara termudah untuk melakukan management bandwidth yang diterapkan pada jaringan skala kecil sampai menengah untuk mengatur pemakaian bandwidth upload dan download tiap user.
/queue simple add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 \ interface=all limit-at=0/8k max-limit=128k/128k name="HTTP Video Traffict" packet-marks=http-video-up parent=none \ priority=8 queue=default-small/default-small total-queue=default-small
/queue simple add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 \ interface=all limit-at=0/0 max-limit=128k/128k name="Queue HTTP Video" packet-marks=http-video-up parent= \ "HTTP Video Traffict" priority=8 queue=default-small/default-small target-addresses=0.0.0.0/0 total-queue= \ default-small
Queue Tree : mirip seperti queue simple tapi lebih rumit, yaitu dapat melakukan pembatasan bandwidth berdasarkan group bahkan secara hierarki. Kita harus mengaktifkan fitur Mangle pada Firewall jika ingin menggunakan Queue Tree
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=256k name=batasidownloadfreebrowsing \ packet-mark=download_pkt parent=global-out priority=8 queue=batasidownload
Subscribe to:
Comments (Atom)
Popular
Tags
Videos