#!/bin/bash
while true
do
if [ `tail -n 50 /data/logs/resin/jvm-app-0.log | grep OutOfMemory | wc -l` -ne 0 ];then
ps aux | grep resin | grep -v grep | awk {'print $2'} | xargs kill -9
/etc/init.d/resin start
fi
sleep 30
done
来源:oschina
链接:https://my.oschina.net/miaojiangmin/blog/3212045