- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How do I identify/summarize active/inactive users?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 10:40 AM
08-13-2003 10:40 AM
We are moving one old server's users and applications to another old server, to consolidate them on one server.
How do I find out who uses the old system and who doesn't.
I wrote a little script to "finger" each name in /etc/passwd:
awk -F: '{print $1}' passwd | while read USER
do
finger $USER
done
but it just spits out raw info:
Login name: lwwajeg In real life: Joe Gagor
Bldg: LPD Shippin
Directory: /home/lwwajeg Shell: /usr/bin/ksh
Last login Fri Jul 5, 2002 on ttypd
No Plan.
Login name: wiwakn In real life: Kumar Natarajan
Directory: /home/wiwakn Shell: /usr/bin/ksh
Never logged in.
No Plan.
Login name: a334hep
Directory: /home/a334hep Shell: /usr/bin/ksh
Last login Fri Aug 8 07:20 on ttypb
No Plan.
Can I summarize that somehow with "awk"?
What I want is something like, all on one line:
username home directory Last login
Stuart
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 10:44 AM
08-13-2003 10:44 AM
Re: How do I identify/summarize active/inactive users?
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 10:46 AM
08-13-2003 10:46 AM
Re: How do I identify/summarize active/inactive users?
Since 'finger' yields information, you have a 'var'adm'wtmp' file of last logins. A one-line summary analysis of last logings can be obtained with 'last'. See the man pages for more information.
# last
# last jrf #...look specifically for user 'jrf'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 10:51 AM
08-13-2003 10:51 AM
Re: How do I identify/summarize active/inactive users?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 10:51 AM
08-13-2003 10:51 AM
Re: How do I identify/summarize active/inactive users?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 11:55 AM
08-13-2003 11:55 AM
SolutionOutput your finger data to : users.raw
Add this line to your script as well:
awk -f formatu.awk < users.raw > users.report
vi a file called formatu.awk in whatever directory you are working and cut and paste the following awk script:
/^Login / {daname=$3;next}
/^Directory/ {dadir=$2;next}
/^Never / {dalast="Never"
printf("%-9s %-40s %-s \n", daname, dadir, dalast);
next}
/^Last login/ {dalast=$3" "$4" "$5" "$6;
printf("%-9s %-40s %-s \n", daname, dadir, dalast);
next}
Double check to make sure that the full printf lines are on one line in the file and that should do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2003 06:17 PM
08-13-2003 06:17 PM
Re: How do I identify/summarize active/inactive users?
# finger -s
This gives you a summarised version & puts everything on one line.
One other point is that often wmtp files are cycled, This can mean finger is unable to get any info on a particular user if that user has not logged in since the wtmp file was cycled.
If you have a trusted system /usr/lbin/getprpw
Unfortunately its a bit messing extracting the info you want.
Cheers
Con
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2003 04:23 AM
08-14-2003 04:23 AM
Re: How do I identify/summarize active/inactive users?
I hope this helps. Final output goes into the /tmp/UserStatus file.