CONTENTS
Lastmodified 2022-09-16 (金) 16:42:34
https://www.google.co.jp/#lr=lang_ja&tbs=lr:lang_1ja&q=FreeBSD+%2Fetc%2Frc.conf+em0+tso
http://matsup.blogspot.jp/2012/12/freebsd-90-ipfw-natd-em.html
http://www.bsddiary.net/d/20100324.html
NEC Express5800/GT110b
FreeBSD 10.2-Rから 11.0-CURRENTへ変更したけど、やっぱり落ちる。ということで、devdを使って見ることにした。
http://www.yosbits.com/opensonar/rest/man/freebsd/man/ja/man5/devd.conf.5.html
http://www.on-sky.net/~hs/misc/?Raspberry+Pi+HA+Server+with+FreeBSD
http://www.yosbits.com/opensonar/rest/man/freebsd/man/ja/man8/devd.8.html?l=ja
devdはシステムに初めから入っているので、
/etc/rc.conf
devd_enable="YES"
として起動するように設定。
/etc/devd/em0.conf
#system=IFNET, subsystem=fxp0, type=LINK_UP notify 0 { match "system" "IFNET"; match "subsystem" "em0"; match "type" "LINK_DOWN"; action "/root/bin/reboot.sh"; };
/root/bin/reboot.sh
#!/bin/sh tail -100 /var/log/all.log | mail -s "System was Rebooted" root@localhost \ && /sbin/reboot
リブート用のスクリプトを書いておく。改行コードがLFでないと動かないので注意。
読み込むかどうかテスト
root@blackhole:~ # devd -d Parsing /etc/devd.conf setting scsi-controller-regex=(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)[0-9]+ setting wifi-driver-regex=(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rum|run|uath|upgt|ural|urtw|urtwn|wi|wpi|wtap|zyd)[0-9]+ Parsing files in /etc/devd Parsing /etc/devd/em0.conf Parsing files in /usr/local/etc/devd devd: Can't open devctl device /dev/devctl: Device busy
起動中のdevdの順番は出来るだけ遅い方がよさげ(NICがLink_UPしてからでないと無限リブートになる)なので、
/etc/rc.d/devd
# REQUIRE: netif ldconfig ntpd
を追加して
#!/bin/sh # # $FreeBSD: head/etc/rc.d/devd 282145 2015-04-28 13:13:23Z glebius $ # # PROVIDE: devd # REQUIRE: netif ldconfig ntpd ←これ 追加したntpd # BEFORE: NETWORKING mountcritremote # KEYWORD: nojail shutdown : :
としてみる。
で、em0がリンクダウンすると、こんなメールがやってくる・・・
To: root@localhost.smb.net Subject: System was Rebooted Message-Id: <20151014012601.DFD9614A63AE@blackhole.smb.net> Date: Wed, 14 Oct 2015 10:26:01 +0900 (JST) From: root@blackhole.smb.net (Charlie Root) Oct 14 10:22:00 blackhole /usr/sbin/cron[63419]: (operator) CMD (/usr/libexec/save-entropy) Oct 14 10:25:00 blackhole /usr/sbin/cron[63432]: (root) CMD (/usr/libexec/atrun) Oct 14 10:25:00 blackhole /usr/sbin/cron[63433]: (munin) CMD (/usr/local/bin/munin-cron) Oct 14 10:26:01 blackhole kernel: em0: Watchdog timeout Queue[0]-- resetting Oct 14 10:26:01 blackhole kernel: Interface is RUNNING and ACTIVE Oct 14 10:26:01 blackhole kernel: em0: TX Queue 0 ------ Oct 14 10:26:01 blackhole kernel: em0: hw tdh = 795, hw tdt = 869 Oct 14 10:26:01 blackhole kernel: em0: Tx Queue Status = -2147483648 Oct 14 10:26:01 blackhole kernel: em0: TX descriptors avail = 949 Oct 14 10:26:01 blackhole kernel: em0: Tx Descriptors avail failure = 0 Oct 14 10:26:01 blackhole kernel: em0: RX Queue 0 ------ Oct 14 10:26:01 blackhole kernel: em0: hw rdh = 680, hw rdt = 679 Oct 14 10:26:01 blackhole kernel: em0: RX discarded packets = 0 Oct 14 10:26:01 blackhole kernel: em0: RX Next to Check = 680 Oct 14 10:26:01 blackhole kernel: em0: RX Next to Refresh = 679 Oct 14 10:26:01 blackhole kernel: em0: link state changed to DOWN
Total access 2959:本日 1:昨日 1