svittal
August 20th, 2009, 02:12 PM
Hi,
I'm trying to maintain a log of 2 jr admin user activities on the server.
In order to do that, I was planning to have the .profile file of each user
mail -s "User admin1 Login" mainadmin@abc.com < date
This will send me an email when the admin1 logs in.
In the .bash_logout I have
[B]mail -s "Admin1 Logged out" mainadmin@abc.com < /home/admin1/.bash_history
>/home/admin1/.bash_history
[/B/
I want to receive an email with the contents of admin1's history.
Question:
1> Is this a good way to do what I'm trying to achieve?
2> When I logout, I get the history from my previous login and not the recent login which should match this logout. Even though I truncate the history file when I logout, it does not happen the way I want. How can you send email of the current history during logout?
I'm trying to maintain a log of 2 jr admin user activities on the server.
In order to do that, I was planning to have the .profile file of each user
mail -s "User admin1 Login" mainadmin@abc.com < date
This will send me an email when the admin1 logs in.
In the .bash_logout I have
[B]mail -s "Admin1 Logged out" mainadmin@abc.com < /home/admin1/.bash_history
>/home/admin1/.bash_history
[/B/
I want to receive an email with the contents of admin1's history.
Question:
1> Is this a good way to do what I'm trying to achieve?
2> When I logout, I get the history from my previous login and not the recent login which should match this logout. Even though I truncate the history file when I logout, it does not happen the way I want. How can you send email of the current history during logout?