How to find logged user informations for last two days from server ?

echo “How to find logged user informations for last two days from server:”

last | awk ‘{print $1 ” ” $5 “-” $6}’ | grep -v : > lastfile

cat lastfile | while read loguser lastdate
do
if [ “$lastdate” = `date | awk ‘{print $2 “-” $3}’` -o “$lastdate” = `date -d’-1 days’ | awk ‘{print $2 “-” $3}’` ]; then
echo $loguser ” ” $lastdate
fi
done

www.pdf24.org    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*