while read USER TIME_START TIME_STOP # Get rid of echo and awk by using shell's IFS
do
at $TIME_START << EOF
passwd -l $USER
EOF
at $TIME_STOP << WTH
passwd -u $USER
WTH
sleep 60 # This should let a minute pass
done < logintime.txt
Do you need to kill the session(s) which are active in that user's closed period? Even then you could issue an "at" job at the appropriate time.
It may mean the person specifying the script did not know about Linux unix "at" command or about special options to "passwd" on certain Linux platforms (it won't work on unix).
@balajesuri
I can't see the point of your sleep unless there is an issue with the number of concurrent "at" jobs. Also, if there list is very long the script could take hours to run.
Checking every minute to get the current time. If it is = TIME_STOP, kill the session of that user (use pkill -KILL -u username) and also lock the username