On Tue, 2003-09-09 at 09:43, Rich Ransom wrote:
> Is there a way to capture events like updating files or writing files 
> to a directory so a script could be run.  For example  every time I 
> modify or add a file having a script automatically run that will copy 
> it to multiple directories?
> -- 
> Rich Ransom
> Webmaster
> KISS Institute
> http://www.botball.org
> http://www.kipr.org
> [EMAIL PROTECTED]
> 

If you can live with near real time backup, you could use a simple
script to see if anything in the directory has changed in the past X
minutes.  Then run that script via cron every X minutes.

On the chance this will meet your needs, below is a sample script to get
you started.

  - Paul

-=-=-=-=-=

#!/bin/sh

DIRTOBAK="/data/special"  # Directory to backup
SCANPERIOD=5              # Scan DIRTOBAK every SCANPERIOD minutes
DEST1="/backup1"          # 1st Destination to backup files to
DEST2="/backup2"          # 2nd    "                        "

PATH=/bin:/usr/bin

FILESTOBAK=`find $DIRTOBAK -type f -mmin -$SCANPERIOD`
if [ -n "${FILESTOBAK}" ]; then #Do not try to copy an empty list
   cp $FILESTOBAK $DEST1
   cp $FILESTOBAK $DEST2
fi





-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to