Developing lightweight computation at the DSG edge

bmx6health.sh 581 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#!/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
12
		/etc/init.d/network reload
13
14
15
16
		if /etc/init.d/gwck enabled
		then
			/etc/init.d/gwck restart
		fi
17
18
19
		/etc/init.d/bmx6 restart
	}
}