#/bin/sh
while true;
do
count=`ps -fe | grep "java" | grep "datanode" | grep -v "grep"`
if [ "$?" != "0" ]; then
/opt/modules/hadoop/hadoop-0.20.203.0/bin/hadoop-daemon.sh start datanode
fi
sleep 2
done
-----------------------------------
#/bin/sh
while true;
do
count=`ps -fe | grep "java" | grep "tasktracker" | grep -v "grep"`
if [ "$?" != "0" ]; then
/opt/modules/hadoop/hadoop-0.20.203.0/bin/hadoop-daemon.sh start tasktracker
fi
sleep 2
done
其实作用是一样的,只是一个前台,一个后台。一个占用bash,一个占用python。