Sunday 10 August 2014

Write a shell script that reports the logging in of a specified user within one minute after he/she log in. The script automatically terminate if specified user does not log in during a specified period of time.


a=`date +%M`
b=`expr $a + 1`
while [ $b -gt `date +%M` ]
do
who | grep $1
if [ $? -eq 0 ]
then
echo "$1 has logged in 1 minute"
exit
fi
done
echo "$1 has not looged in within 1 minute"

1 comments:

Anonymous said...

this isnt working

Post a Comment

 
- |