Submitted by sothorn on อาทิตย์, 08/16/2009 - 23:17
Posted in
เป็นเรื่องจาก cyberciti.biz นะครับ วิธีการเขียน Bash Shell ให้ส่งเมลเตือนเมื่อดิสก์เต็ม
#!/bin/bash # Tested Under FreeBSD and OS X FS="/usr" THRESHOLD=90 OUTPUT=($(LC_ALL=C df -P ${FS})) CURRENT=$(echo ${OUTPUT[11]} | sed 's/%//') [ $CURRENT -gt $THRESHOLD ] && echo "$FS file system usage $CURRENT" | mail -s "$FS file system" you@example.com
ที่มา : http://www.cyberciti.biz/faq/mac-osx-unix-get-an-alert-when-my-disk-is-full
- sothorn's blog
- อ่าน 830 ครั้ง
