Sponsored Content
Top Forums Shell Programming and Scripting bash script for showing last users Post 302365489 by vassu on Tuesday 27th of October 2009 07:54:56 AM
Old 10-27-2009
Quote:
Originally Posted by thegeek
2. What do you mean by predetermining ? Cant understand that.
It means that user inserts some date [example input: Oct 26 11:00 - Oct 27 14.00] and script output shows all users, who have been logged in during this time, alphabetically. And shows how many sessions they have had in this period. Somehow it can be predetermined to show according to "date" field. Right now without script it shows like this:
Code:
frogger rubiin/wazzar> cat lastfile | cut -c1-8 | egrep -v '(^reboot)|(^$)|(^wtmp a)|(^ftp)' | sort | uniq -c | sort -k 1 | last -10
a72093   pts/6        172.17.1.42      Tue Oct 27 14:00   still logged in
wazzar   pts/4        218.255.196.88.s Tue Oct 27 13:55   still logged in
a72093   pts/15       172.17.1.42      Tue Oct 27 13:50 - 13:59  (00:09)
aller    pts/16                        Tue Oct 27 13:45 - 13:45  (00:00)
aller    pts/15                        Tue Oct 27 13:45 - 13:46  (00:00)
aller    pts/7                         Tue Oct 27 13:45 - 13:50  (00:04)
aller    pts/6                         Tue Oct 27 13:45 - 13:50  (00:04)
a83553   pts/14       fl01.fil.ut.ee   Tue Oct 27 13:38   still logged in
laure    pts/13                        Tue Oct 27 13:34   still logged in
laure    pts/9                         Tue Oct 27 13:31   still logged in

wtmp begins Wed Oct 21 19:10:34 2009
frogger rubiin/wazzar>

Script should show something like this:
Code:
Example:\\>users.sh  Oct 26 11:00 - Oct 27 14.00
 SESSIONS      USER              LAST LOGIN
   12              userA      Tue Oct 27 13:45 - 13:50  (00:04)
    3               userB      Tue Oct 27 13:31   still logged in
    5               userC      Tue Oct 27 13:31   still logged in
   ...              .......        ............................................


Last edited by vassu; 10-27-2009 at 09:50 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash/awk scripting help (creating OLD new users)

I need some help making this script... I guess I'm having trouble even interpretating what to even get started on... I need to create a script that will search a given directory (typically a user's home directory, but not necessarily) as provided on the command line and any sub-directors for... (2 Replies)
Discussion started by: Jukai
2 Replies

2. Shell Programming and Scripting

Showing offline users

Hi, Is there any command for showing offline users? The only way I can think of doing it (as i cant find a command) is getting a list of all the online users, and comparing it to /etc/passwd, anything that is in /etc/passwd and not in the users file will be offline users. But I have no... (4 Replies)
Discussion started by: mikejreading
4 Replies

3. Shell Programming and Scripting

Bash Help: users who are not logged into the system to display

A Newbie here, I am working on a script and am having problems with the else part of the script. I can't get the users who are not logged into the system to display on the screen with their username and the text "The user is not logged in". I am sure it is something simple and stupid, but I... (5 Replies)
Discussion started by: rchirico
5 Replies

4. UNIX for Dummies Questions & Answers

Need help showing which network protocol users use.

I'm having a bit of a trouble trying to figure out how to tell which network protocol users HAVE been logging in with. I know how to find this information for currently logged in users : maximillian.gardner@syccuxfs01:~> who joseph.blosser pts/0 2012-01-15 14:07 (198.107.160.185)... (5 Replies)
Discussion started by: maximillian.g
5 Replies

5. Red Hat

Showing all users in 'users' and 'top' commands

Hi All, I work in a multi user environment where my school uses Red Hat Linux server. When I issue commands such as "top" or "users", I get to see what others are doing and what kinds of applications they are running (even ps -aux will give such information). "users" will let me know who else is... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Shell Programming and Scripting

Script in bash wchich creating a new users...

Hi, I am a new on this forum but i like :) I need a script in bash which will be crating a new user with folder for websites. For example: I will run this program and he creating a new user(with my name) and folder whcich name like user and if i will localho/~user in browser, she show me files from... (1 Reply)
Discussion started by: puclavv
1 Replies

7. UNIX for Dummies Questions & Answers

About adding users from a text file using bash

hello, I try to add users from a text file with this form: username:groupename:homedir first i extract data which is separated by ":" then i use useradd to add users/groups. but,,, my code doesn't works : #!/bin/bash echo "give me a text file: " read dir # control if... (2 Replies)
Discussion started by: ref012
2 Replies

8. Ubuntu

Expect /bash, 2 ssh login users

HI all i need to connect to about 900 cisco routers and switch to do some configs changes. the issue i am having is that half the devices have one set of username and password and the other half have another username and password. From expect or bash script i can ssh into a device and make... (1 Reply)
Discussion started by: quintin
1 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
PTS_QUIT(1)						       AFS Command Reference						       PTS_QUIT(1)

NAME
pts_quit - Exit from pts interactive mode SYNOPSIS
pts quit [-cell] <cell name> [-noauth] [-localauth] [-force] pts q [-c] <cell name> [-n] [-l] [-f] DESCRIPTION
The pts quit command exits from pts interactive mode. The command can be run from the command line or interactively, but on the command line it does nothing and is therefore of questionable utility. CAUTIONS
Prior to OpenAFS 1.4.5 and OpenAFS 1.5.23, the pts quit command was only available on Unix or Linux and when OpenAFS was compiled with the supergroups option (disabled by default). As of OpenAFS 1.4.5 and 1.5.23, it is always available. OPTIONS
Although they have no effect, pts quit takes the following standard pts options: -cell <cell name> Names the cell in which to run the command. For more details, see pts(1). -force Enables the command to continue executing as far as possible when errors or other problems occur, rather than halting execution at the first error. -help Prints the online help for this command. All other valid options are ignored. -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. Do not combine this flag with the -cell or -noauth options. For more details, see pts(1). -noauth Assigns the unprivileged identity anonymous to the issuer. For more details, see pts(1). OUTPUT
This command produces no output. EXAMPLES
Here is an example of a pts interactive session: % pts interactive pts> quit % SEE ALSO
pts(1), pts_interactive(1) COPYRIGHT
Copyright 2007 Jason Edgecombe <jason@rampaginggeek.com> This documentation is covered by the BSD License as written in the doc/LICENSE file. This man page was written by Jason Edgecombe for OpenAFS. OpenAFS 2014-04-08 PTS_QUIT(1)
All times are GMT -4. The time now is 03:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy