Ah, important safety tip as that will be the case.
Since I'm not comfortable implementing technology I don't fully understand, would you be so kind as to translate into English each line of your script? I think I get the basic drift of it..."take a snapshot of the contents of a directory, take another and compare the two, if their different send an e-mail, if their not, start all over again" or something like that. Getting warm?
That is exactly it. For the record, here is a commented version, as I would have written it if I were implementing it on my own server:
#!/bin/sh # # Notify the admin if a directory's contents has changed. #
# The directory to monitor. watchdir='/path/to/ftpdir'
# Who gets notified of changes. This may be a # comma-delimited list, but no spaces. recipient='[EMAIL PROTECTED]'
# The file that holds an md5sum of the directory # listing, as of the last time it was changed. sumfile='/path/to/sumfile'
## End of settings ##
# Get the previous md5sum of the directory listing. olddirsum=`cat $sumfile`
# Get the current md5sum of the directory listing. Use the # --full-time option to avoid errors based on ls changing the # displayed date format based on the age of the file. newdirsum=`ls --full-time $watchdir | md5sum`
# Compare the previous md5sum to the current md5sum. if [ "$newdirsum" != "$olddirsum" ]; then # The directory listing changed. # Send notification message. ls $watchdir | mail -s "Updated dirlist: $watchdir" $recipient
# Update the summmary file with the current md5sum. echo "$newdirsum" > "$sumfile" fi
-- Anthony E. Greene <mailto:[EMAIL PROTECTED]> OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D AOL/Yahoo Chat: TonyG05 HomePage: <http://www.pobox.com/~agreene/> Linux. The choice of a GNU generation. <http://www.linux.org/>
-- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list