#!/bin/ksh
for SRV in imawasp01 \
imawasp02 \
imawasp03 \
imawasp04 \
imawasp05 \
imawasp06 \
imawasp07 \
imawasp08 \
imawasp09
do
print "${SRV}"
while read PASSLINE
do
SRVNAME=`echo ${PASSLINE} | awk -F\: '{print $1}'`
LASTLOGIN=`ssh ${SRV} lsuser ${SRVNAME} | tr ' ' '\n' | awk -F= '$1 ~ /time_last_login/ {print $2}'`
LASTFAILEDLOGIN=`ssh ${SRV} lsuser ${SRVNAME} | tr ' ' '\n' | awk -F= '$1 ~ /time_last_unsuccessful_login/ {print $2}'`
echo "${SRVNAME},${LASTLOGIN},${LASTFAILEDLOGIN}" >> /tmp/${SRV}_logintimes.txt
done < ${SRV}_passwd.txt
print "=================="
done
${SRV}_passwd.txt
is a local copy of /etc/password file from each server SRV
Setting LASTLOGIN or LASTFAILEDLOGIN causes that inner do loop to break out to the next server after reading just the first line from the password file. If I comment out those two lines the do loop will cycle for every line in the password file.
I don't understand what is causing this behavior.
Thank you for your help.