The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
error occurs while some users login rrlog HP-UX 0 08-12-2007 04:55 PM
Users with login privileges sprellari Linux 2 08-23-2006 05:22 AM
Change users login name spacewalker AIX 9 03-20-2006 11:09 AM
Tracking activities of Users using a particular login. jyotipg UNIX for Advanced & Expert Users 4 08-04-2003 11:43 AM
NIS users cann't login on AIX and HP mod UNIX for Advanced & Expert Users 3 08-22-2001 11:25 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2008
lo-lp-kl lo-lp-kl is offline
Registered User
  
 

Join Date: Jul 2004
Location: Mexico
Posts: 157
users login

Hello everyone

I need to send to a file the last command from all users who log in and log out by week or month.

My questions are

I can do it with the command or I need to do a script ?

If the answer is I need to do a script, someone can help me because Im complete new to make a script.

I know that I can send the last command to a file.

last >testlogin.txt

but I need to do this more specific by week or month, by user maybe


Thanks for your tips


Greetings
  #2 (permalink)  
Old 05-22-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Question please clarify

Looking at the last command, and it output, what do you mean by user's last command? It shows user, connection, day, date, time, and possibly if still connected.

A script could be written to extract from this file, but do not understand what you are trying to find. Can you supply more info and perhaps a sample of what you are trying to create?

A command like:
Code:
last | tr -s " " | cut -d" " -f1,5 | sort -u
would show users and months they had access/activity in.
  #3 (permalink)  
Old 05-22-2008
lo-lp-kl lo-lp-kl is offline
Registered User
  
 

Join Date: Jul 2004
Location: Mexico
Posts: 157
users login

Thanks for your reply joeyg

If I type the last command and to a text file. I get this

last >usuarios.txt
root pts/0 160.40.35.277 May 22 11:08 still logged in.
root pts/0 alopez02 May 22 09:23 - 10:11 (00:47)
root pts/0 160.40.35.277 May 20 13:07 - 13:29 (00:21)
root pts/1 alopez02 May 19 13:19 - 13:35 (2+00:15)

I need to do the same thing but by user, by week or month


Thanks again


Greetings
  #4 (permalink)  
Old 05-23-2008
lo-lp-kl lo-lp-kl is offline
Registered User
  
 

Join Date: Jul 2004
Location: Mexico
Posts: 157
users login

Hello everyone

I update my question.

Thanks for your reply joeyg

If I type the last command and send to a text file. I get this

last >usuarios.txt
root pts/0 160.40.35.277 May 22 11:08 still logged in.
root pts/0 alopez02 May 22 09:23 - 10:11 (00:47)
root pts/0 160.40.35.277 May 20 13:07 - 13:29 (00:21)
root pts/1 alopez02 May 19 13:19 - 13:35 (2+00:15)

I need to do the same thing but order by week and user.

Another question how I can send the txt file to another computer by ftp

Thanks again


Greetings
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0