I'm not 100% sure if this is the right place to post this or even the right forum but i'll ask all the same. I was trying to make a script so that when root logs in, it will run this script and let me know when me last disconnection.
I use Debian and worked out that file i'm working with is:
So I was using:
cat /var/log/messages | grep Hangup
Sep 16 11:48:45 xionous pppd: Hangup (SIGHUP)
Sep 16 14:24:26 xionous pppd: Hangup (SIGHUP)
Sep 18 05:27:33 xionous pppd: Hangup (SIGHUP)
but of course that's not always going to work cause the log rotates.
So I ask, how would I first get it to loop through the files increasing til it gets a value, and if there is a value it will get the last one. So "Sep 18 05:27:33 xionous pppd: Hangup (SIGHUP)", and then I only want to grab the date/time.
Any help would be great, or even if you could point me in the right direction.