#!/bin/sh
#!/bin/bash

if [ $(xycall list | grep -c ipklist) -eq 0 ];then
    ps axuf | grep  '/usr/local/xyvod/xyapp/xyipk/bin/xyipk' | grep -v grep | awk '{print$2}' | xargs kill -9
fi

sleep 60
ps auxf | grep [n]odeexporter  | awk '{print$2}' | xargs kill -9
#/usr/local/xyvod/xyapp/system/miner.plugin-nodeexporter.ipk/start.sh &

grep miner.plugin-datacollect.ipk /etc/rc.local &&  sed -i /etc/rc.local '/miner.plugin-datacollect.ipk/'d
grep miner.plugin-flume.ipk /etc/rc.local &&  sed -i /etc/rc.local '/miner.plugin-flume.ipk/'d
grep miner.plugin-netd.ipk /etc/rc.local &&  sed -i /etc/rc.local '/miner.plugin-netd.ipk/'d
grep miner.plugin-nodeexporter.ipk /etc/rc.local &&  sed -i /etc/rc.local '/miner.plugin-nodeexporter.ipk/'d
if [ $(cat /etc/rc.local | egrep -c "miner.plugin-datacollect.ipk|miner.plugin-flume.ipk|miner.plugin-netd.ipk|miner.plugin-nodeexporter.ipk") -ne 0 ];then
   echo -e "fail,禁止部分插件开机自启动设置失败...\n"
fi
