[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] Notify of New Users-RAQ XTR



-----Original Message-----
From: Edward R. Milstein [mailto:eddie@xxxxxxxxxxx]
Sent: Tuesday, June 18, 2002 4:25 PM
To: cobalt-users@xxxxxxxxxxxxxxx
Subject: RE: [cobalt-users] Notify of New Users-RAQ XTR


> 
> 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

_______________________________________________

If there are diffs, wouldn't one want to do
a: cp $PASSWD $PASSWDBACKUP
so that the same differences aren't detected
on the next cron cycle?
_______________________________________________
cobalt-users mailing list
cobalt-users@xxxxxxxxxxxxxxx
To Subscribe or Unsubscribe, please go to:
http://list.cobalt.com/mailman/listinfo/cobalt-users