36.每隔5秒查看hadoop用户是否登录,如果登录,显示其登录并退出;否则,显示当前时间,并说明hadoop尚未登录:
#!/bin/bash
#
who| grep "hadoop" &> /dev/null
RETVAL=$?
while[ $RETVAL -ne 0 ]; do
echo "`date`, hadoop is not log."
sleep 5
who | grep "hadoop" &>/dev/null
RETVAL=$?
done
echo"hadoop is logged in."
转载于:https://blog.51cto.com/315805980/1555268