Breaking News
You are here: Home / Program Code / UNIX / write a script to check every minute whether a particular user has been login or not and count the number of minute’s user was late login.

write a script to check every minute whether a particular user has been login or not and count the number of minute’s user was late login.

$vi loginlate.sh 
clear
echo -e "\n Enter username :\c"
read uname
ans='y'
t=0

while [ $ans = 'y' ]
do

for i in `who | cut -d " " -f 1`
do
        if [ $i = $uname ]
        then

                   echo -e "\n $uname is $t
minutes late  login "
                ans='n'
                                        fi
done

        if [ $ans = 'y' ]
        then
                sleep 10
                t=`expr $t + 1`
        fi

done

:wq

Download Paper Solutions from Below Link

About admin

Scroll To Top