- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to find users who didn't logging from the ...
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
Discussions
Discussions
Forums
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
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
тАО06-25-2007 08:29 AM
тАО06-25-2007 08:29 AM
How to find users who didn't logging from the last 60 days
I want to find users who didn't logging from the last 60 days.
for i in `awk -F: '$3 > 100 { print $1 }' /etc/passwd`
do last $i | head -1 done
With the above script it want find the users who didn't logging even once. It is showing blank.
Thanks
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2007 02:37 PM
тАО06-25-2007 02:37 PM
Re: How to find users who didn't logging from the last 60 days
Thu Apr 26 22:33:37 EDT 2007
]# last|grep kumarts
kumarts pts/1 hcj-60762b23.noa Mon Jun 25 22:31 still logged in
kumarts pts/0 hcj-60762b23.noa Mon Jun 25 22:17 still logged in
kumarts pts/0 hcm-25122c0e.noa Sun Jun 24 11:09 - 21:03 (09:54)
kumarts pts/0 mas-5828e2cd.noa Sun Jun 24 09:59 - 11:05 (01:06)
kumarts pts/0 bpt-d33c3932.noa Sat Jun 23 21:33 - 01:19 (03:45)
kumarts pts/1 hsl-582f0205.noa Tue Jun 19 21:17 - 23:09 (01:51)
kumarts pts/0 adq-e43b9ed5.noa Mon Jun 18 20:18 - 08:27 (12:08)
kumarts pts/0 asc-587c2d96.noa Tue Jun 12 22:40 - 08:36 (09:56)
kumarts pts/1 adc-41e47d2e.noa Tue Jun 12 09:17 - 17:40 (08:22)
kumarts pts/0 adc-41e47d2e.noa Tue Jun 12 09:15 - 17:51 (08:35)
kumarts pts/0 kjw-25134059.noa Thu Jun 7 22:06 - 07:20 (09:14)
kumarts pts/0 adc-41e47d2e.noa Mon Jun 4 08:55 - 18:16 (09:21)
kumarts pts/0 rfp-587c2faf.noa Sat Jun 2 11:59 - 02:33 (1+14:33)
Do a test loop/comaprison between those outputs. If you find a newer entry on second output than the first output , the match fails.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2007 12:20 PM
тАО06-26-2007 12:20 PM
Re: How to find users who didn't logging from the last 60 days
#!/bin/bash
lim=`date --date "60 days ago" +%m%d`
for user in `awk -F: '$3 > 100 {print $1}' /etc/passwd` ; do
test_date=`last -R -1 $user|grep -v wtmp|cut -c27-32`
if [ -z "${test_date}" ]
then
echo "$user never logged in"
else
test_mon=`echo "$test_date"|awk '{print $1}'`
test_day=`echo "$test_date"|awk '{print $2}'`
test "$test_day" -lt 10 && test_day="0"${test_day}
case "${test_mon}" in
Jan) test_mon="01" ;;
Feb) test_mon="02" ;;
Mar) test_mon="03" ;;
Apr) test_mon="04" ;;
May) test_mon="05" ;;
Jun) test_mon="06" ;;
Jul) test_mon="07" ;;
Aug) test_mon="08" ;;
Sep) test_mon="09" ;;
Oct) test_mon="10" ;;
Nov) test_mon="11" ;;
Dec) test_mon="12" ;;
esac
test "${test_mon}${test_day}" -gt $lim || echo "$user ${test_mon}${test_day}"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2007 05:09 PM
тАО06-26-2007 05:09 PM
Re: How to find users who didn't logging from the last 60 days
Use date --date "60 days ago"
Thanks & Regrads
Reshma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2007 02:31 AM
тАО07-03-2007 02:31 AM