Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
The task is to measure the density of users that are logged on system. The program
should check that every 30 sec, but not check older logs than 2 days(24h) and write that into a text file. So the logs shouldn't be older than 2 days. The records of logged users must be saved in a file for today and what was going on yesterday.
And the time difference MUST be 30 seconds between checkings...
It should look like this:
Time: 11:50:10 Users: 2
Time: 11:50:40 Users: 5
1.file for today Today.txt
2.file for yesterday logs Yesterday.txt
3. The attempts at a solution (include all code and scripts):
I'm thinking about the function who -Hlrmu and to cat that into a file
than read how many lines a file has minus the first one.
I don't know how to measure the time and to separate the files into two,
one for today and one for yesterday.
Am I on the right path? I'm not i know hahaha
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of Ljubljana, Ljubljana, Slovenia, Janez Novak, ID63709
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Last edited by radoulov; 05-27-2010 at 06:59 PM..
Reason: changed title; deleted "urgent"
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.
For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.
Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.
If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.
Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.
Aha, what if i use $(users | wc -l)
coz, who returns me on two consoles tty7 and pts/0
How can i separate the files, the Today.txt must contain users who were logged in today
and Yesterday.txt must contain yesterday logs, and i should have no more than 2 days old logs.
Something like if [ $(date +%Y%m%d).log -ge than 48h ]; than delete it?
How can i tell if a file is older than 2 days?
---------- Post updated at 03:58 PM ---------- Previous update was at 02:40 PM ----------
it would be even better if i rewrite from today.txt into yesterday.txt, but only when
24 hours passes and the today.txt will be blank.
What i mean is...i must keep track of the users for 24 h and then rewrite it
to a yesterday.txt file!
Hi All
We have a job which writes files to a server at a particular time. The files will be created by a particular user ID
Today, during the execution of the job, it created a file to the server and the file sat on the server for sometime, but was deleted immediately at the end of the... (4 Replies)
Hi All
Please can you help me with the following issue:
A certain vendor installed an application in which for a user to log in; the user must use a user created/predefined by the application. And because this application has more than one user its difficult to track who did what and when,... (6 Replies)
Hi, i suddenly realized that a directory is deleted unfortunately there are many user have pervilages on this directory
is there a way to track the user who delete this directory
or atleast from now can i enable something so that i can track from now
I think there is way from... (2 Replies)
Recently we've had a couple user accounts mysteriously disappear. Is there any way to track these accounts and determine who/how they were deleted? (2 Replies)
Hi,
I have a unix server and I am concerned about the security on that server.
I would like to be able to write a script that records all the commands that were typed at the command prompt before the user calls the 'history -c' command and deletes all the history.
I was thinking about firing or... (7 Replies)
Hi
Does anybody know if there is a way in AIX 5.3 to track how a user was logged off? For instance where the user typed exit, hit crtl D, shell process was killed, etc.
I know of the last log entries but this just shows a users login time and duration. I also tried syslog but I only get login... (5 Replies)
dear all ,
I m new to shell programming and I need your help.
Actually i want to keep track of all the commands executed in a bash prompt of users ,
very much in same manner as it is displayed when we run "history" command.
now the users are smart enough as they delete their history by... (6 Replies)
Like the topic says, does anyone know if it is possible to check to see when an FTP only user has logged in? Because the shell is /bin/false and they are only using FTP to access the system doing a "finger" or "last" it says they have never logged in.
Is there a way to see when ftp users log in... (1 Reply)
hi
I want to know how to save all the command used by all the used under a particular root with the time stamp in a file.
Eg:
User Name: UX10
Time: 10:56
Command: LS
User Name: UX23
Time: 10:59
Command: MORE abc.txt
-Anand (2 Replies)
Can I do it like this?
if (strcmp(argv, "history")==0)
{
argv = "10";
execvp(argc,argv);
}
actually, it doesn't work,
How can I modify it?
Thanks (17 Replies)