Link to home
Start Free TrialLog in
Avatar of Denisvt
Denisvt

asked on

Directory surveillance or synchronization

Hello,
I have this situation I'd like help on : during a project development we are granting someone FTP access to a subdirectory on our Linux server. However for several reasons we'd like to be aware of all activity in that workspace and also have a backup solution, so that for example if a file is uploaded and then removed we'd still be aware of that and have a copy of the file. I had in mind to use rsync and/or a tool detecting changes inside that dir, but I'm not sure how that would translate ?
Making a copy of the dir to another directory with a timestamp every minute would not be too rational even though disk space is not an issue...Could that idea be combined with a "change detection" tool (tripwire ?) triggering the backup/copy only when changes occur ?
Regards,
 
Avatar of xscousr
xscousr
Flag of Canada image

pure-ftpd allows you to run a script after each file is uploaded. With this feature you could write a script which backed up or copied the files as they came up.

http://www.pureftpd.org/index.shtml

run pure-ftpd as your ftp server and the second daemon pure-uploadscript and use something like

#!/bin/bash
#
# copy uploaded file and email a notification
#
DATESTAMP=`date +%Y%m%d`
TIMESTAMP=`date +%Y%m%d_%H%M_%S`
notifymail="/tmp/notifymail"
archive="/var/archive"
log="/var/log/upload-${TIMESTAMP}.log"
upload="$1"
fname="$1"
        if [ $var1 = usertowatch ]; then
        chmod g+rwx $upload
        cp $upload $archive
        echo "File Uploaded at $TIMESTAMP" >$notifymail"
        echo " ">>$notifymail
        echo "Name                            Size" >>$notifymail"
        echo " " >>$notifymail
        ls -lh $upload | awk ' { print $9 "         " $5 }' >>$notifymail
        mail -s "New File uploaded to FTP" alert@domain.com <$notifymail
        rm $notifymail

fi

Avatar of Denisvt
Denisvt

ASKER

Right now the server we use runs ProFTPD, would you solution require that we install that other FTP server and/or replace our current one ?
I guess our contact has to use that server so that the script can be triggered ?

ASKER CERTIFIED SOLUTION
Avatar of xscousr
xscousr
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Denisvt

ASKER

Thanks.