[an error occurred while processing this directive]
by Guido Socher (homepage)
¹ØÓÚ×÷Õß:
Guido ϲ»¶Linux²»µ«ÒòΪÁ˽â²Ù×÷ϵͳÈçºÎ¹¤×÷ÊÇÒ»¼þÓÐȤµÄÊ£¬¶øÇÒҲӦΪ³ÁÃÔÓÚËüµÄÉè¼ÆµÄÈËÃÇ
Ŀ¼:
|
A Hardware watchdog and shutdown button
ÕªÒª:
ÖÆ×÷LCD¿ØÖÆÃæ°å ÖнÒʾÁËÈçºÎ¾¡×î´ó¿ÉÄܹ¹½¨Ò»¸ö»ùÓÚ΢´¦ÀíÆ÷µÄLCD¿ØÖÆÃæ°å
ͨ³£Çé¿öÏÂÎÒÃDz»ÐèÒªËùÓеÄÌصã,ÎÒÃÇËù¹¹½¨µÄÓ²¼þºÜÁ®¼Û(Õâ¸öLCD¿ØÖÆÃæ°åÊÇÊг¡ÉÏÒѾÉÌÆ·»¯)²¢ÇÒ¾ßÓкÍÆäËûLCDÆÁ²»Í¬µÄÁ½¸öÖØÒªÌصã.
- Ò»¸ö°´¼üÓÃÀ´Í£Ö¹ÏµÍ³·þÎñÆ÷
- Ò»¸ö¿´ÃŹ·¼àÊÓϵͳ·þÎñÆ÷
Ó²¼þÖ»ÊÇÓɺܶàÓÐЧµÄÁã¼þ×é³É£¬Äú¿ÉÒÔºÁ²»·ÑÁ¦µØµÃµ½ËûÃÇ£¬ËùÓеÄÁã¼þ¼ÓÆðÀ´²»µ½5Å·Ôª
ʲôÊÇ¿´ÃŹ·?
¿´ÃŹ·ÔÚ¼ÆËã»úϵͳÖÐÊÇÒ»¸ö×îÖÒʵµÄ¿ÉÐÅÀµµÄÓ²¼þ£¬ÓÃÀ´±£Ö¤ÏµÍ³³¤¾ÃÔËÐУ¬ÄúÄܹ»ÔÚ»ðÐÇ·¢ÉäÆ÷ÖÐ(ÈËÃÇͨ¹ý°´¸´Î»¼üÀ´·¢ÉäÒ»¸öÈ˵½»ðÐÇÉÏ?)»òÕßÆäËû°º¹óµÄ×°ÖÃÖÐÕÒµ½ÀàËÆÉ豸.
¿´ÃŹ·µÄʹÓÃ˼·ºÜ¼òµ¥:¼ÆËã»ú±ØÐ벻ʱµØ¶Ô¿´ÃŹ·Ëµ"ÄãºÃ"ÒÔÈÿ´ÃŹ·ÖªµÀËüÒÀÈ»ÔÚÔËÐУ¬Èç¹ûÕâÖÖ²Ù×÷ʧ°Ü£¬¿´ÃŹ·µÄ¶¯×÷¾Í»áÒýÆðϵͳӲ¼þ¸´Î»¡£
ÓÉÓÚÒ»¸öLinux·þÎñÆ÷ÐèÒª¼¸¸öÔ²»¼ä¶Ï¹¤×÷£¬Æ½¾ù´ó¸Å1-2Äê²»·¢ÉúËÀ»úÏÖÏó,Èç¹ûÄúµÄ»úÆ÷ÿ¼¸ÖܾͻáËÀ»úÄÇôÕą̂»úÆ÷Ò»¶¨ÓÐÒì³£²¢ÇÒ¿´ÃŹ·²»Äܽâ¾öÎÊÌâ,±ØÐëÒª¼ì²éʹµÃCPU¹ýÈȵĴíÎóµÄRAM(²Î¼û memtest86.com)£¬Ì«³¤µÄIDEÁ¬½ÓÏß...
Èç¹ûÒ»¸öLinuxϵͳÄܹ»ÔÚ¿´ÃŹ·µÄ¼à¿ØÏÂÈç´Ë¿É¿¿µØÎÞ¹ÊÕÏÔËÐÐÒ»Ä꣬Äú»¹ÓÐʲôÀíÓɲ»Ê¹Óÿ´ÃŹ·ÄØ£¿´ð°¸ºÜ¼òµ¥:¿´ÃŹ·ÈÃϵͳ¸ü¿É¿¿¡£¾ÍÏñÈËÀà½â¾ö×Ô¼ºµÄÎÊÌâÒ»Ñù¡£
һ̨·þÎñÆ÷ÎÞ¹ÊÕÏÔËÐÐÒ»Äê»ù±¾Éϲ»ÎªÈËËùÖª£¬Èç¹ûËü³öÁËÎÊÌâҲûÓÐÈËÖªµÀÂð£¿ÄÇ¿ÉÄܾÍÊÇËü¸ÕºÃ¸ÏÔÚÊ¥µ®½ÚÇ°ËùÓÐÈ˶¼ÔÚ¼ÒÀïµÄʱºòËÀ»ú¡£ÎªÁË·ÀÖ¹ÕâЩ£¬¿´ÃŹ·¾ÍÏԵúÜÓÐÓÃ.
µ«ÊÇ¿´ÃŹ·²»Äܽâ¾öËùÓÐÎÊÌ⣬ÔÚÓÐȱÏݵÄÓ²¼þÃæÇ°ËüÒ²»áÏÔµÃÎÞÄÜΪÁ¦£¬¼´Ê¹ÔÚÄãµÄϵͳÓÐÒ»¸ö¿´ÃŹ·£¬ÄãÒ²Ó¦¸Ã×¢ÒâÈ·±£Ò»¸öÁ¼ºÃµÄÓ²¼þ»·¾³(ÖÁÉÙ²»Ó¦¸ÃÊÇBIOSµÄBUGºÍоƬ±¾ÉíµÄBUG)ÒÔ¼°ÊʶȵÄÀäȴϵͳ¡£
Èç¹ûʹÓÿ´ÃŹ·?
¿´ÃŹ·µÄÉè¼Æ½ö½öΪÁ˱£Ö¤Óû§Çø³ÌÐòµÄÔËÐУ¬ÎªÁËÓµÓÐÒ»¸öÈ·Ðŵġ¢Îȶ¨ÏµÍ³£¬Äú»¹±ØÐë¼à¿ØÄúµÄÓ¦ÓóÌÐò(ÍøÂç·þÎñ£¬Êý¾Ý¿â)ºÍϵͳ×ÊÔ´(´ÅÅ̿ռ䣬CPUζÈ)¡£ÄúÒ²¿ÉÒÔͨ¹ýÆäËûµÄÓû§Ó¦ÓóÌÐòÀ´´ïµ½Ä¿µÄ(crontab),ËùÓÐÕâЩ²ûÊö¶¼ÔÚLCD¿ØÖÆ°åÖ÷Ìâ,ÔÚ´Ë£¬ÎÒ²»ÏêÊöÁË.
ÀýÈç:ÕâÊǸöС½Å±¾ËüÄܹ»¼à¿ØÍøÂçÔËÐУ¬ÄÚ´æ½»»»ÒÔ¼°´ÅÅÌÓ¦ÓÃÇé¿ö¡£
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
export PATH
#
# Monitor the disk
# ----------------
# check if any of the partitions are more than 80% full.
# (crontab will automatically send an e-mail if this script
# produces some output)
df | egrep ' (8.%|9.%|100%) '
#
# Monitor the swap
# A server should normally be dimensioned such that it
# does not swap. Swap space should therefore be constant
# and limited.
# ----------------
# check if more than 6 Mb of swap are used
swpfree=`free | awk '/Swap:/{ print $3 }'`
if expr $swpfree \> 6000 > /dev/null ; then
echo "$0 warning! swap usage is now $swpfree"
echo " "
free
echo " "
ps auxw
fi
#
# Monitor the network
# -------------------
# your _own_ IP addr or hostname:
hostn="linuxbox.your.supercomputer"
#
if ping -w 5 -qn -c 1 $hostn > /dev/null ; then
# ok host is up
echo "0" > /etc/pingfail
else
# no answer count up the ping failures
if [ -r /etc/pingfail ]; then
pingfail=`cat /etc/pingfail`
else
# we do not handle the case where the
# pingfail file is missing
exit 0
fi
pingfail=`expr "$pingfail" "+" 1`
echo "$pingfail ping failures"
echo "$pingfail" > /etc/pingfail
if [ $pingfail -gt 10 ]; then
echo "more than 10 ping failures. System reboot..."
/sbin/shutdown -t2 -r now
fi
fi
# --- end of monitor script ---
½áºÏÉÏÃæµÄÕâЩºÍcrontabÈë¿ÚÀ´Ã¿¸ô15·ÖÖÓÔËÐÐÕâ¸ö½Å±¾Ò»´Î
1,15,30,45 * * * * /where/the/script/is
¿´ÃŹ·µÄÓ²¼þ×é³É
¼ÌµçÆ÷²¢²»±ê×¼£¬Ã¿Ò»ÖÖ²úÆ·¶¼ÓÐËû×Ô¼ºµÄÉè¼ÆÌص㣬¶ÔÎÒÃǵĵç·À´Ëµ,×îÖØÒªµÄÊÇÆäÄÚ²¿µç×èÖµ£¬Äú¿ÉÒÔ¿´µ½ÏÂÃæÁ½ÕÅͼ£¬Ò»ÕÅΪ 5V,500 Å·Ä·µç×èµÄ¼ÌµçÆ÷£¬Ò»×éΪ5V£¬120Å·Ä·µç×èµÄ¼ÌµçÆ÷£¬Äã¿ÉÒÔÓÃÄãÒÑÓеÄÅ·Ä·±í²âÁ¿³ö¼ÌµçÆ÷µÄµç×èÖµ£¬Í¨¹ýµã»÷ÔÀíͼ·Å´ó²é¿´´óͼ.
120 Å·Ä·¼ÌµçÆ÷:
500 Å·Ä·¼ÌµçÆ÷:
¹Ø±Õ°´Å¥ÎªÒ»¸ö½ÓÔÚRTSºÍCDÉϵÄÇá´¥¿ª¹Ø¡£µç·ͼÉÏ¿´ÆðÀ´ÓеãÄ°ÉúÊÇÒòΪEagle¹«Ë¾Ã»ÓÐÌṩһ¸ö¸üºÃµÄͼ±ê¡£
ÔÚÕâÀïÎÒûÓÐÁгöÏêϸµÄÔª¼þÇåµ¥£¬Äã¿ÉÒÔÔÚÉÏÃæµÄÔÀíͼÀïÃæÕÒµ½ÏëÒªµÄÒ»ÇÐ(±ðÍü¼ÇÁ¬½Ó´®¿ÚÏßµÄDB9²åÍ· )£¬ÀïÃæµÄ¶þ¼«¹ÜÄú¿ÉÒÔʹÓÃÈÎÒâÐͺŵÄÌæ»»£¬Èç1N4148.ÎÒ¸öÈËÈÏΪ£¬500Å·Ä·¼ÌµçÆ÷µÄµç·ҪºÃһЩ,ÒòΪÄú²»ÐèÒªR4ºÍ2000uF(»òÕß2200uF)µçÈÝ£¬µçÈÝC1Ö»ÐèÒªÒ»¸ö½ÏСµÄ1000uFµçÈݾ͹»ÁË£¬
Çë×¢Òâ:ÔÚ120Å·Ä·µÄµç·ÀïÄãÐèÒªÒ»¸öºìµÆ£¬¶øÔÚ500Å·Ä·µç·ÀïÐèÒªÒ»¸öÂ̵ƣ¬Õâ²»ÊÇÄÖ×ÅÍæµÄ£¬ÒòΪÂ̵ƵÄѹ½µ±ÈºìµÆÒª´ó¡£
Ïß·°åÉè¼Æ·½Ã棬EagleÎļþºÍ¹ØÓÚÏß·°å¸¯Ê´ÃæµÄ×¢ÊͶ¼ÔÚºóÃæµÄÈí¼þ°üÖÐEagle CADÔÚLinuxϵÄÉè¼ÆÈí¼þÀ´×ÔÓÚ cadsoftusa.com.
µç·ÊÇÈçºÎ¹¤×÷
¿´ÃŹ·Ó²¼þµç·ΧÈÆNE555ʱ»ùоƬ´î½¨£¬Õâ¸öоƬ°üº¬Á½¸ö±È½ÏÆ÷£¬Ò»¸öRS´¥·¢Æ÷ºÍÈý¸ö5Kµç×èÌṩ±È½ÏÆ÷µÄ²Î¿¼µçѹ£¬Ö»ÒªÃÅÏÞÒý½Å(6)³¬¹ý2/3µçÔ´µçѹ
¾Í»áÒýÆðRS´¥·¢Æ÷ÖÃλ(״̬ÓÐЧ)¡£
ÏÖÔÚÀ´¿´ÎÒÃǵĵç·ͼ:ÎÒÃÇÀûÓô®¿ÚµÄRTSÒý½ÅÌṩµçÔ´µçѹ£¬ÓÉÓÚRS232´®¿ÚµçѹÊÇ+/-10V£¬Òò´Ë£¬ÎÒÃÇÔÚµçÈÝC1Ç°Ãæ±ØÐëÒªÒ»¸ö¶þ¼«¹Ü¡£C1¿ìËÙ³ä·ÅµçÒÔά³Öʱ¿ÌÌṩϵͳÄÜÔ´¡£µç×èC2Ôò±È½Ï»ºÂýµØͨ¹ý4.7M µç×è³ä·Åµç¡£RS232´®¿ÚDTRÒý½ÅÉϵÄÂö³å¿ØÖƾ§Ìå¹ÜT1·ÅµôµçÈÝC2ÉϵĵçºÉ.Èç¹ûÕâ¸öÂö³åûÓÐ(ÓÉÓÚ¼ÆËã»úËÀ»ú)µçÈÝC2Éϵĵçѹ×îÖÕ(´óÔ¼40Ãë)¾Í»á³¬¹ý2/3µçÔ´µçѹ£¬´Ó¶øÒýÆðRS´¥·¢Æ÷ÖÃλ¡£
µçÈÝC1,µç×èR2ºÍLED·¢¹â¹Ü£¬¼ÌµçÆ÷²ÎÊýÐèÒª¾¹ýµ÷ÊÔ£¬ÓÉÓÚÈü̵çÆ÷¿ìËٱպϵÄÄÜÁ¿À´×ÔC1£¬¶øC1ÌṩµÄµçÁ÷²»×ãÒÔÈü̵çÆ÷³¤Ê±¼äά³Öµ¼Í¨¡£ÎÒÃDZØÐëͨ¹ý"°´ÏÂ""¸´Î»"¼ü1-2Ãë.À´¹Ø±Õ¼ÌµçÆ÷µ¼Í¨×´Ì¬¡£
LED·¢¹â¹ÜÒ»Ö±±£³Ö·¢¹âÖ±µ½ÏµÍ³ÔÚ¸´Î»ÒÔºóÖØлָ´ÔËÐÐ.
ÄúÒ»¶¨¿´µ½ÁËÔÀíͼÀïÃæ½ÓÔÚCDÒý½ÅÉϵĹػú°´Å¥£¬Ö»ÒªÄúÇá´¥Ëü(±£³Ö15Ãë)Ö®ºóÇý¶¯Èí¼þ¾Í»áÔËÐÐ"shutdown -h now"ÃüÁî²¢¹Ø±Õϵͳ·þÎñÆ÷¡£ÕâÊǸø³£¹æϵͳά»¤ÓõĺͿ´ÃŹ·ºÁÎÞ¹Øϵ£¡
Çý¶¯Èí¼þ
Çý¶¯Èí¼þÊÇÒ»¸öСµÄC³ÌÐò¿ÉÒÔÓÉ/etc/init.d/½Å±¾ÔËÐУ¬Ëü²»Í£µØ·×ªRS232µÄRTSÒý½Å²¢ÇÒÿ¸ô12ÃëÖÓ·¢ËÍÒ»¸öÂö³å¸øDTR(¿´ÃŹ·µÄ¶¨Ê±Ê±¼ä40Ãë)£¬µ±ÄúÕý³£¹Ø±Õ¼ÆËã»ú£¬³ÌÐò¾Í»á¹Ø±ÕRTSÐźŲ¢ÇÒ¸ø³ö×îºóÒ»¸öDTRÂö³å¡£ÕâÑùµÄÄ¿µÄ¾ÍÊÇÔÚ³¬Ê±·¢Éú֮ǰ·ÅµôµçÈÝ(C1)ÉϵĵçºÉ.Òò´Ë£¬Õý³£Çé¿öÏ£¬¿´ÃŹ·¾Í²»»áÊܵ½µçÁ÷³å»÷¡£Òª°²×°Õâ¸öÈí¼þÇë½â¿ªlinuxwd-0.3.tar.gzѹËõ°ü,Äú¿ÉÒÔ´Ó ÎļþÏÂÔØÁ´½Ó µÃµ½Õâ¸öÎļþ£¬È»ºó½âѹËõÔËÐÐmakeÃüÁî½øÐбàÒë¡£
²¢ÇÒ¿½±´Õâ¸ölinuxwd¿ÉÖ´ÐÐÎļþµ½/usr/sbin/linuxwd.±à¼µ±Ç°linuxwd_rc½Å±¾(Èçredhat/mandrake,»òÕßlinuxwd_rc_anydist Èç¹ûÊÇÆäËûÀàÐ͵Äϵͳ)£¬È»ºóÊäÈëÕýÈ·µÄ´®¿ÚµØÖ·(Èç ttyS1=COM2 »òÕß ttyS0=COM1)£¬È»ºó¿½±´Õâ¸örc½Å±¾µ½
/etc/rc3.d/S21linuxwd
ºÍ
/etc/rc5.d/S21linuxwd
¼´´ó¸æ¹¦³ÉÁË.
ϵͳ²âÊÔ
µ±ÄúÒѾº¸½ÓºÃÁËËùÓеÄÔª¼þÒÔºó£¬Äú±ØÐëÔÚÁ¬½Óµ½¼ÆËã»ú֮ǰ½øÐбØÒªµÄ²âÊÔ¡£½«½ÓÏÂÀ´ÐèÒªÁ¬½Óµ½´®¿ÚRTSÒý½ÅµÄÏß½ÓÉÏ9-10VÖ±Á÷µçÔ´£¬²¢Çҵȴý40-50ÃëÖÓ.Äú¾Í»áÌýµ½¼ÌµçÆ÷±ÕºÏµÄºÜÇáµÄÏìÉù£¬Í¬Ê±·¢¹â¹ÜÒ²»á·¢ÁÁ¡£×¢Òâ²»ÄÜÈü̵çÆ÷±£³Ö³¤Ê±¼äµ¼Í¨¡£LEDָʾµÆ½«»á³¤ÁÁ£¬Ö±µ½Äú°Ñ½ÓDTRÒý½ÅµÄÐźÅÏß½Ó+10V¡£
µ±Äú¾¹ýÉÏÊö¼ìÑéÒÔºó£¬Äú¾ÍÍêÈ«¿ÉÒÔ°ÑËüÁ¬½Óµ½µçÄÔÉÏÈ¥ÁË£¬Õâ¸ölinuxwd³ÌÐòÓÐÒ»¸ö²âÊÔģʽ£¬ÔÚËüÊä³öһЩ´òÓ¡ÐÅÏ¢²¢Í£ÁôÒ»¶Îʱ¼ä²Å·¢ËÍÂö³å¸øDTR£¬ÓÃÀ´Ä£ÄâϵͳËÀ»úÏÖÏó£¬Ê¹ÓÃÃüÁîlinuxwd -t /dev/ttyS0
Èà linuxwd ÔËÐÐÔÚ²âÊÔģʽ (ʹÓà /dev/ttyS1 Èç¹ûÄúµÄÓ²¼þÁ¬½ÓÔÚCOM2ÉÏ).
Ó²¼þ°²×°
RS232½Ó¿ÚÐźÅÈçÏÂ:
¼ÆËã»ú·½ÏòµÄ 9 ÕëDÐͲåÍ·¡£
9 PIN-connector |
25 PIN-connector |
Name |
Dir |
Description |
1 |
8 |
CD |
input |
Carrier Detect |
2 |
3 |
RXD |
input |
Receive Data |
3 |
2 |
TXD |
output |
Transmit Data |
4 |
20 |
DTR |
output |
Data Terminal Ready |
5 |
7 |
GND |
-- |
System Ground |
6 |
6 |
DSR |
input |
Data Set Ready |
7 |
4 |
RTS |
output |
Request to Send |
8 |
5 |
CTS |
input |
Clear to Send |
9 |
22 |
RI |
input |
Ring Indicator |
Ïß·°å°²×°µ½RS232´®¿ÚµÄʱºòÒ»¶¨ÒªÕý£¬Äú±ØÐëÏÈͨ¹ý²éÕÒ¼ÆËã»úµÄ¸´Î»°´Å¥À´²éÕÒϵͳ¸´Î»Ïߣ¬²¢ÇÒ°ÑËüÁ¬½Óµ½¼ÌµçÆ÷µÄÊä³ö¶Ë£¬¼ÌµçÆ÷µÄÊä³ö¶Ë²¢ÁªÔÚ¸´Î»°´Å¥ÉÏ¡£
½áÂÛ
¿´ÃŹ·²»ÊÇ100%±£Ö¤ÏµÍ³µÄÎȶ¨£¬µ«ÊÇ£¬Ëü»áÌá¸ßϵͳµÄ°²È«ÐÔÄÜ£¬×îÖ÷ÒªµÄÎÊÌâÊÇÔÚϵͳӲ¼þ¸´Î»ÒÔºó£¬ÎļþϵͳÈçºÎÕÒµ½Ã»ÓÐÍê³ÉµÄ¹¤×÷µÄλÖã¬×îеÄÈÕÖ¾Îļþ»òÐí¿ÉÒÔ°ï棬µ«ÊÇÎÒûÓÐÊÔͼ½øÐÐÂÛÊö¡£ÕâÀï½éÉܵĿ´ÃŹ··Ç³£±ãÒË£¬Ò²²»ÄÑÖÆ×÷²¢ÇÒ¼¸ºõºÍ´ó²¿·ÖÉÌÆ·Ò»ÑùºÃ¡£
²Î¿¼
¶ÔÕâƪÎÄÕ·¢±íÆÀÂÛ
ÿƪÎÄÕ¶¼Óи÷×Եķ´À¡Ò³Ãæ¡£ÔÚÕâ¸öÒ³ÃæÀÄú¿ÉÒÔÌá½»ÆÀÂÛ£¬Ò²¿ÉÒԲ鿴ÆäËû¶ÁÕßµÄÆÀÂÛ£º
2002-07-24, generated by lfparser version 2.25