ar51an / raspberrypi-motd

Dynamic Message Of The Day (MOTD) For Raspberry Pi
MIT License
62 stars 14 forks source link

Last is current #8

Closed sky1es closed 1 year ago

sky1es commented 1 year ago

"Last" is showing current login date/time. To get last login change "NR==1" to "NR==2" in "/update-motd.d/15-system".

ar51an commented 1 year ago

It is working exactly as intended. It shows the last login not current login. Last login log is updated after motd is displayed. If you execute the cmd after login with NR=1, it will show you the current login.

image

If you delete all your last login log history. It shows you "None", just like the first ever login.

image

If you are still not seeing the correct behavior, may be something different/wrong with your setup/OS. BTW, welcome to github.

sky1es commented 1 year ago

You are right :-) Thanks for the explanation. I ran the code after login, and so got the current login. It makes sense. Sorry to bother you with this.