配置shell脚本启动hdfs集群,crontab定时启动shell脚本

shell脚本
#!/bin/sh
ps -ef|grep namenode|grep -v grep
if [ $? -ne 0 ]
then
for host in node01
do
        ssh $host "source /etc/profile;nohup /root/export/servers/hadoop-2.6.0-cdh5.14.0/sbin/start-dfs.sh >/dev/null 2>&1 &"
        echo "$host hdfs is running"

done
echo "我在开起"
else
echo "我被执行了一次,不执行了"
fi

 

crontab -e

*/1 * * * * /root/shells/start_hdfs.sh  

你可能感兴趣的:(配置shell脚本启动hdfs集群,crontab定时启动shell脚本)