Sponsored Content
Full Discussion: Login ID cleanup
Operating Systems AIX Login ID cleanup Post 302073345 by truma1 on Friday 12th of May 2006 04:20:25 AM
Old 05-12-2006
#!/bin/ksh
#set -vx
FALSE=false
current_time=$(perl -e 'print time (),"\n";')
let expired_time=current_time-7776000
let delete_time=current_time-15552000
awk -F: '{print $1}' /etc/passwd|while read records
do
if [ "$records" = "dm" -o "$records" = "root" -o "$records" = "daemon" -o "$records" = "bin" -o "$records" = "sys" -o "$
records" = "adm" -o "$records" = "uucp" -o "$records" = "guest" -o "$records" = "nobody" -o "$records" = "lpd" -o "$reco
rds" = "nuucp" ];then
SYS=$records
else
SYS=nonsys
fi
last_login_time=$(lsuser -a time_last_login $records|awk -F= '{print $2}')
account_status=$(lsuser -a account_locked $records|awk -F= '{print $2}')
if [ "$last_login_time" = "" ];then
if [ $records = $SYS -a "$records" != "root" -a "$account_status" = "false" ];then
# chuser account_locked=true $records
printf "%-8s never logged on. The account should be locked\n" $records
fi
if [ $records != $SYS -a "$records" != "root" ];then
# chuser account_locked=true $records
printf "%-8s never logged on. The account should be locked\n" $records
fi
elif [ $records = $SYS -a $records != "root" -a "$account_status" = "false" ];then
#chuser account_locked=true $records
printf "%-8s never logged on. The account should be locked\n" $records
elif [ $records != $SYS ];then
if [ $last_login_time -lt $delete_time ];then
printf "%-8s last logged on 6 months ago. The account needs to be deleted! Check /logs/backlogs/rmusers.log\n"
$records
echo $records must be removed. `date` >> /logs/backlogs/rmusers.log
elif [ $last_login_time -lt $expired_time ];then
# chuser account_locked=true $records
printf "%-8s last logged on 3 months ago. The account should be locked\n" $records
fi
fi
done
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sendmail cleanup

What is the correct procedures to clean up /var/spool/mqueue? Any help appreciated. This directory gets really clogged up at times. :( :( (1 Reply)
Discussion started by: thomi39
1 Replies

2. Shell Programming and Scripting

Help with cleanup

I am trying to add a unique string to a variable to prevent some name space collisions. DATAFILE=/u001/app/unica/affinium644/campaign/partitions/limited/tmp/ebf9aaah.t~# DATETIME=`date +%Y%m%d_%H%M%S` echo $DATAFILE > tmpnme.txt sed 's_/_ _g' tmpnme.txt > tmpnme2.txt DATA=$(cat tmpnme2.txt)... (2 Replies)
Discussion started by: whdr02
2 Replies

3. Shell Programming and Scripting

Cleanup script

Hi! I would like to write a script which remove some files, all beginning with the same prefix : prefix.1 doc/prefix.2 ../prefix.3 etc. So, I would create a file and chmod it executable. But I dont know how to pass a variable to a script. I would like to write something like ... (2 Replies)
Discussion started by: tipi
2 Replies

4. Solaris

/home cleanup

Hi All, I have this script for linux on cleaning up orphaned folder. But I need to use this on solaris 8/9/10 for user in $(ls | grep -v lost+found) ; do id $user >/dev/null 2>&1 if ] then ls -ld $user grep $user /etc/passwd fi done Can someone please convert this script? ... (1 Reply)
Discussion started by: itik
1 Replies

5. Shell Programming and Scripting

cleanup $PATH with awk

Hello there, I want to remove duplicate directories of $PATH. I already have the code (found in this forum), which removes duplicate lines in a textfile. awk 'x++==0' filename By how do I use this for the $PATH-variable? (17 Replies)
Discussion started by: doc_symbiosis
17 Replies

6. Shell Programming and Scripting

Cleanup between parenthesis

Hi, I am trying to clean up data between parenthesis () in a file. See example below.... Input File : (New York) Chicago (London) New York (Chicago) London New York Chicago (London) (New York) (Chicago) (London) New York (Chicago) ... (3 Replies)
Discussion started by: msalam65
3 Replies

7. Red Hat

How to Cleanup Multipathing

I have a server running redhat 5.5 and it has one SAN device presented to it as LUN9. How can I clean up the remaining entries. I cannot afford to interupt the service. Please assist. # multipath -l mpath0 (36000097000019260298953666633436) dm-11 EMC,SYMMETRIX \_ round-robin 0 \_ 2:0:0:9 ... (2 Replies)
Discussion started by: Tirmazi
2 Replies

8. OS X (Apple)

Adobe application cleanup

I am trying to come up with a universal way of cleaning up after CS5 (and 5.5) installs. The history is this: adobe has a deployment tool called AAMEE that lets you re-package items and deploy them. Unfortunately it's very messy and leaves Application folders (and pieces of the apps) that do not... (1 Reply)
Discussion started by: kleinboy
1 Replies

9. OS X (Apple)

Text file cleanup

Hi there, i do get some text files that i'd lile to clean them up based on following rule: if a line starts with " then remove return (new line, carriage return) before ". Example, my input text file line 1 line 2 "line 3 I'd like this to come as line 1 line 2line3 How can i... (4 Replies)
Discussion started by: gigagigosu
4 Replies

10. UNIX for Advanced & Expert Users

RPM Repo Cleanup

Greetings all, I have inherited this offline Red Hat YUM repo that contains over 42000 packages. You read that right. There are 71 kernels alone. The process that I've inherited has us reposync on an Internet-connected-server then sneaker-net the delta to our offline repo where we do a yum... (2 Replies)
Discussion started by: geoeldsul
2 Replies
dictCleanup(3)							    util/dict.h 						    dictCleanup(3)

NAME
dictCleanup - cleanup dictionary SYNOPSIS
#include <util/dict.h> void dictCleanup(dictCtx dict, dictCleanupFunc cleanup, void *rock); ARGUMENTS
dict - dictionary to cleanup cleanup - cleanup callback rock - to pass to <cleanup> DESCRIPTION
Calls <cleanup> for every item in <dict>. If <cleanup> returns true, then item is removed from <dict>. MT-Level: Safe if <dict> thread-safe. RETURN VALUE
None. SEE ALSO
dictDestroy(3), dictCleanup(3), dictReleaseLock(3), dictRemove(3), dictNext(3), dictCreate(3), dictSetValue(3), dictModifyValue(3), dict- Search ClearSilver 12 July 2007 dictCleanup(3)
All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy