Developing lightweight computation at the DSG edge

Commit 563a2a8f authored by p4u's avatar p4u
Browse files

Added script in crontab to check if bmx6 is working fine. If not it tries to...

Added script in crontab to check if bmx6 is working fine. If not it tries to fix it (first small implementation of bmx6 health daemon)
parent d071751d
#!/bin/sh
# Check if bmx6 is stoped
[ ! -f /proc/$(cat /var/run/bmx6/pid)/status ] && {
echo "[$(date)] Starting bmx6, it was down."
logread > /tmp/bmx6_crash_$(date +%Y%M%d_%H%m).log
/etc/init.d/bmx6 restart
} || {
# Check if there is some interface working
[ $(bmx6 -c show=interfaces| grep -c UP) -le 0 ] && {
echo "[$(date)] There is no interface working, restarting network and bmx6."
logread > /tmp/bmx6_crash_$(date +%Y%M%d_%H%m).log
/etc/init.d/network restart
/etc/init.d/bmx6 restart
}
}
#!/bin/sh
if ! cat /etc/crontabs/root | grep bmx6health; then
echo "*/10 * * * * /etc/qmp/bmx6health.sh >> /tmp/log/bmx6health.log" >> /etc/crontabs/root
/etc/init.d/cron enable
/etc/init.d/cron start
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment