They are very simple scripts which i understand (used pieces found in existing scripts on internet), i´m sure most of you think is pretty basic , but since i did´t find them already on this forum i thought i share´m with you.
i have a r7800(since 2days back) currently running 18.0.6.1
pingcheck, if ping.sunet.se is down it will restart my wan interface
#!/bin/bash
x=`ping -c1 ping.sunet.se 2>&1 | grep bad`
if [ ! "$x" = "" ]; then
echo "It's down!! Attempting to restart."
date >> /tmp/ping-down
ifdown wan
sleep 1
ifup wan
fi
and my script to verify if collectd is running (been dying a couple of time, not sure why..yet)
#!/bin/bash
ps | grep collectd | grep -v grep > /dev/null
if [ $? != 0 ]
then
/bin/date >> /tmp/collectd-crash
/etc/init.d/collectd start
fi
Just stick´m in crontab with intervall of your choice
/t