วันอังคารที่ 31 มีนาคม พ.ศ. 2552

อบรม freebsd Server ให้กับโรงเรียน




เปิดอบรมให้กับโรงเรียนครับ..รับ 37 คนเหนื่อยน่าดู แบบวิทยกรคนเดียว...พื้นฐานครูไม่เหมือนกันไปไม่พร้อมกัน..ทำให้ลำบากในการ
ควบคุมการอบรม อบรม 3 วัน ต้องแถมให้ีอีกหนึ่งวัน เอ้อ..เหนื่อยจริง ๆ

วันเสาร์ที่ 28 มีนาคม พ.ศ. 2552

squid error

squid -N -X สำหรับดูว่าในไฟล์ squid.conf มี error ตรงไหนบ้างครับ
ปัญหาส่วนใหญ่ที่ access.log สั่ง tail -f แล้วไม่เห็นอะไรขึ้นมักเิกิดจากไม่ได้สั่ง chmod 755 หรือสั่งไม่ถูกไฟล์ครับ..

วันพุธที่ 4 มีนาคม พ.ศ. 2552

netcut กับ chilli

max0405
ค้นๆ เจอในพี่ google ในระบบ chillispot ให้แก้ไขดังนี้
# MAC authentication

# TAG: macauth
# If this flag is given users will be authenticated only on their MAC
# address.
# Normally you do not need to uncomment this tag.
#macauth
macauth เอา # ออก

# TAG: macallowed
# List of MAC addresses.
# The MAC addresses specified in this list will be authenticated only on
# their MAC address.
# This tag is ignored if the macauth tag is given.
# It is possible to specify this tag multiple times.
# Normally you do not need to uncomment this tag.
#macallowed 00-0A-5E-AC-BE-51,00-30-1B-3C-32-E9
macallowed 00-0C-29-66-D4-47 ค่าของ eth1

# TAG: macpasswd
# Password to use for MAC authentication.
# Normally you do not need to uncomment this tag.
#macpasswd password
macpasswd test ตั้ง password

# TAG: macsuffix
# Suffix to add to MAC address in order to form the username.
# Normally you do not need to uncomment this tag.
#macsuffix suffix
macsuffix test เอา # ออกและ password

ทดสอบ โดยการใช้ netcut cut off ตัว gateway ทีนี้ออกอินเตอร์เน็ตได้ ตามปกติ แต่ถ้าไม่แก้ไขดังกล่าว ใช้ netcut cut off gateway เดี้ยงครับ

สร้าง script ลบ squid 90 วันอัตโนมัติ...

บทความ aminta แห่ง www.thaibsd.com
ได้เวลาว่าง ๆ มาตอบซะที ผมเขียนแบบกำปั้นทุบดินนะครับ
อีกอย่างผมยังไม่ได้ลองนะนี่ (5555+ แต่น่าจะได้ละ)

อันดับแรกเลยนะครับ สร้าง sh shell script ใช้ editer ที่ถนัด save เป็น dot sh (ex. squid90day.sh)
ระบุ path ตามต้องกรของผมสมมุติที่อยู่ File อยู่ที่ /usr/local/ นะครับ ชื่อไฟล์ squid90day.sh
รายละเอียดตามด้านล่าง


----------------------- squid90day.sh -------------------------
#!/bin/sh
catdate=`cat /tmp/squid90days.tmp`
echo $catdate
if [ $catdate -gt 90 ];then
#ใส่คำสั่งที่คุณต้องการลงไปได้หรือเปลี่ยน Path ของ Squid Cache ข้างล่างบรรทัดนี้ครับ
rm -d /usr/local/squid/cache
mkdir /usr/local/squid/cache
squid -zD
else
catdate=$(($catdate +1))
echo $catdate > /tmp/squid90days.tmp
fi
---------------------------- EOF ------------------------------------


สังเกตุบรรทัดที่ 2 -> catdate=`cat /tmp/squid90days.tmp`
ให้เราไป สร้าง File หรือFolder ที่เห็นคือ /tmp/squid90days.tmp
หรือใช้คำสั่ง


---------------------------- Command ----------------------------
#mkdir /tmp
#echo 0 > /tmp/squid90days.tmp
---------------------------- EO CMD ----------------------------


ต่อมา crontab มีความหมายดังนี้
* * * * * command/script do you want
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

หรือเพิ่มลงไปที่บรรทัดสุดท้ายของ File "/etc/crontab" ตามนี้

-----------------------
1 0 * * * /usr/local/squid90day.sh
-----------------------


หมายถึงทำทุก เที่ยงคืนหนึ่งนาที ของทุกๆวัน

หากต้องการ Test script นี้ให้แก้ไขที่บรรทัดที่ 4 ของ File squid90day.sh ให้เป็น 1 ครับ
เพื่อทดสอบเก็บ log 1 วัน (อันนี้แล้วแต่ๆ)

หวังว่าคงไม่ขาดตกส่วนไหนไปนะครับ ท่านอื่นช่วยวิจารด้วยนะครับ
ผมยัง ยังไม่ได้สร้างส่วนของการสร้าง File และ Folder ของ Temp File ต้องสร้างเองด้วยมือ ท่านใดช่วยเขียนต่อด้วยนะครับ ขอขอบพระคุณ ผิดพลาดประการใดขออภัยมา ณ ที่นี้ (aminta)