LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   I Need Fantastic Script for Loging (http://www.linuxquestions.org/questions/programming-9/i-need-fantastic-script-for-loging-842274/)

aiushtha 11-04-2010 03:51 AM

I Need Fantastic Script for Loging
 
Hi,
I need;
1- X user login to server
2- X user used command du,mkdir,cat .. etc.
3- 1-2 actions and included command print send specified emails.


How can I do? Thanks.

genderbender 11-04-2010 05:03 AM

My advice would be to:
1. Using lastb get the last users to login to the server, it's upto you how you use this data (print $1 would give you the user name, but you'd get duplicates).
2. Stick this in a for loop and do for user in `the query above which shows only the usernames`; do cat /home/$user/.bash_history; done;
3. Don't get this. I'm not writing the script for you though, I'll help with anything you've wrote so far, but I think it's unfair to come here just demanding code also - it sounds like homework.

I'm sure there are better more intelligent ways of achieving the same thing anyway.

HasC 11-04-2010 06:11 AM

Quote:

Originally Posted by aiushtha (Post 4148860)
Hi,
I need;
1- X user login to server
2- X user used command du,mkdir,cat .. etc.
3- 1-2 actions and included command print send specified emails.


How can I do? Thanks.

come back when you have some code to show, *then and only then* ask for help


All times are GMT -5. The time now is 11:02 AM.