shell脚本每隔5秒判断一次某个帐号登陆系统没有,登陆的话,则退出脚本
#!/bin/bash # who | grep "pengge" &> /dev/null n=`echo $?` while [ $n -ne 0 ];do echo "`date`,pengge is not log!" sleep 5 who | grep "pengge" &> /dev/null n=`echo $?` done echo "pengge is logging!"
shell脚本每隔5秒判断一次某个帐号登陆系统没有,登陆的话,则退出脚本
#!/bin/bash # who | grep "pengge" &> /dev/null n=`echo $?` while [ $n -ne 0 ];do echo "`date`,pengge is not log!" sleep 5 who | grep "pengge" &> /dev/null n=`echo $?` done echo "pengge is logging!"