[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] Notify of New Users-RAQ XTR
- Subject: RE: [cobalt-users] Notify of New Users-RAQ XTR
- From: "Edward R. Milstein" <eddie@xxxxxxxxxxx>
- Date: Tue Jun 18 13:27:01 2002
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
>
> Why not maintain two copies of your /etc/passwd file, and have a cron
> script regularly perform a diff on the two?
This presumes one has a tmp directory under admin and this is run from
admin.
Need to add the crontab of course..
#!/bin/csh -f
# set echo
# set verbose
#
# Keep track of new users added to the /etc/passwd file
#
# Set some globals
set PASSWD = /etc/passwd
set TMPFILE = /tmp/$0.$$
set PASSWDBACKUP = ~/tmp/passwd.diffcopy
#
# Create a backup copy if it doesn't exist already
#
if ( ! -f $PASSWDBACKUP ) then
cp $PASSWD $PASSWDBACKUP
endif
#
# Diff the two versions to see if there are any adds
#
diff $PASSWD $PASSWDBACKUP > $TMPFILE
#
# If the size of the diff is greater than 0
#
if ( -s $TMPFILE ) then
mail -s $0 $USER < $TMPFILE
endif
#
# Clean up
#
rm $TMPFILE