script to keep trackk of my last login
Hi,
I would like to edit my .bashrc to help me keep track of when I last logged on. I have my image set on my hard drive so my home directory is permanant. Now, I would like whenever I log it for the script to tell me when was the lat time I logged in, how many times I have loged in so far and record my new login time.
I was thinking of using a file to record the login date and a login counter but I don't know how to overwrite a file at every login with the new informatiion. Nor do I know how to read a file at log in to capture this information... Any ideas?
Thanks,
Re: script to keep trackk of my last login
Example:
' last dave |head '
Code:
dave pts/7 :0.0 Thu May 11 11:24 still logged in
dave pts/0 :0 Thu May 11 11:24 still logged in
dave pts/7 :0.0 Thu May 11 11:24 - 11:24 (00:00)
dave pts/2 :0.0 Thu May 11 10:48 - 11:24 (00:35)
dave pts/0 :0 Thu May 11 10:48 - 11:24 (00:35)
dave tty2 Thu May 11 10:48 still logged in
dave pts/9 :0.0 Wed May 10 23:43 - 01:51 (02:08)
dave pts/8 :0.0 Wed May 10 22:00 - 00:53 (02:53)
dave pts/8 :0.0 Wed May 10 21:08 - 21:59 (00:51)
dave pts/2 :0.0 Wed May 10 21:07 - 01:51 (04:44)
Quote:
Originally Posted by ejodoin
Hi,
I would like to edit my .bashrc to help me keep track of when I last logged on. I have my image set on my hard drive so my home directory is permanant. Now, I would like whenever I log it for the script to tell me when was the lat time I logged in, how many times I have loged in so far and record my new login time.
I was thinking of using a file to record the login date and a login counter but I don't know how to overwrite a file at every login with the new informatiion. Nor do I know how to read a file at log in to capture this information... Any ideas?
Thanks,