SoftEther VPN (UT-VPN) の死活監視っぽい、少なくともHeartbeatではない何か
CentOS6/SL6向け。なぜか偶にリンクが落ちるのでゴリ押し。
/etc/cron.hourly とかに突っ込んどけば幸せになれるかもしれない。
valid_ip() の中身は以下を利用させて頂きました(コピペしてきて下さい)。
http://nullpopopo.blogcube.info/2013/07/valid_ipv4.html
#!/bin/sh MN_DEVICE=(堕ちた時に再起動掛けるデバイス名) MN_TARGET=1(反応を見る相手側のIPアドレス) function valid_ip() { return } function dev_restart() { local dev=$1 ifdown $dev sleep 3 ifup $dev echo [`date +"%Y/%m/%d %H:%M:%S"`] $MN_DEVICE was restarted. sleep 5 } function alive_monitor() { local target=$1 local from_dev=$2 ping $target -I $from_dev -c 3 if [ $? = 0 ] then echo [`date +"%Y/%m/%d %H:%M:%S"`] The connection to $target is alive. return 0 else echo [`date +"%Y/%m/%d %H:%M:%S"`] The connection to $target is dead. return 1 fi } function device_monitor(){ local device=$1 IP_ADDR=`ifconfig $device|grep "inet addr"|cut -f 2 -d':'|cut -f 1 -d' '` valid_ip $IP_ADDR if [ $? = 0 ] ; then echo [`date +"%Y/%m/%d %H:%M:%S"`] $MN_DEVICE was alive. return 0 else echo [`date +"%Y/%m/%d %H:%M:%S"`] $MN_DEVICE was dead. return 1 fi } device_monitor $MN_DEVICE if [ $? != 0 ] ; then dev_restart $MN_DEVICE fi alive_monitor $MN_TARGET $MN_DEVICE if [ $? != 0 ] ; then dev_restart $MN_DEVICE alive_monitor $MN_TARGET $MN_DEVICE fi