- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script for Dormant 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
01-20-2005 06:43 PM
01-20-2005 06:43 PM
run the script on that day and it will generate the list of users who have not logon for the last n days (n maybe 30, 60)
ive tried last, comm with /etc/passwd but its so general for the Month only and doesnt care of the Year.
i wonder if there are ways to calculate the last 30 days of todays date...then filtering em out login details..
tnx..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 06:50 PM
01-20-2005 06:50 PM
Re: Script for Dormant Users
Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 07:01 PM
01-20-2005 07:01 PM
Re: Script for Dormant Users
for user in `ls -1 /home | grep -v "lost+found"`
do
if [ `find /home/$user -name .sh_history -mtime -30 | wc -l` = 1 ]
then
echo "User $user has logged in during the last 30 days"
else
echo "User $user has NOT logged in during the last 30 days"
fi
done
All the best - Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 07:04 PM
01-20-2005 07:04 PM
Re: Script for Dormant Users
actually, ive done it via finger -sw, redirecting the output to a file, then manually sorting it out (whew!). now, i really wonder how can it be improved considering that i have about 5000 users per server.
im thinking of the date... can we manipulate the date command (or its output) so that we could have it deducted for n days? all i viewed is the formatting output, w/c if ur goin to do it mathematically (date - 30), obviously gives the wrong value considering that day is not in decimal.
i wonder if theres a script that could calculate current date minus n_dates..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 07:08 PM
01-20-2005 07:08 PM
Re: Script for Dormant Users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 08:11 PM
01-20-2005 08:11 PM
Re: Script for Dormant Users
The solution with a find on the .sh_history file can still work if you change the name of the history file to include the userid, like:
export HISTFILE=~/histories/.sh_hist.$LOGNAME
to keep history files small use
export HISTSIZE=100
This means you will collect some 5000 history files in the 'histories' directory, but that should not be a problem.
HTH
Timo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 08:53 PM
01-20-2005 08:53 PM
Re: Script for Dormant Users
# perl -e 'print scalar localtime(time - (30 * 86400))'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2005 09:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 01:18 AM
01-24-2005 01:18 AM
Re: Script for Dormant Users
have you had a look at my script?
IS this problem still open, or can the thread be closed?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 03:36 AM
01-24-2005 03:36 AM
Re: Script for Dormant Users
I use the 'last' command and it variations. I keep a wtmp file for some 90 days, if a user does not show up in the last output then I know that user has not logged in for the last 90 days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 11:19 AM
01-24-2005 11:19 AM
Re: Script for Dormant Users
we may close this thread now.
matsalams!