PDA

Visualizza la versione completa : Sincronizzare con ftp


lordwizard
02-02-2005, 12:39
Devo sincronizzare una cartella locale con un servizio ftp esterno ogni 5min.
Conoscete qualche programma ho sentito parlare di mirror ma non ho trovato niente di simile in source forge e co.
Per me č molto importante vi rignrazio in anticipo.
Ciao
Davide

techtemple
02-02-2005, 16:55
Puoi usare rsync( http://samba.anu.edu.au/rsync/ ), dai un occhiata a questi esempi: http://samba.anu.edu.au/rsync/examples.html . Oppure puoi usare l'accoppiata wget && crontab. ti incollo uno script che uso, magari ti puņ essere utile come esempio.



#!/bin/sh

# When run, this script will generate a mirror of the PuTTY website
# in a subdirectory called `putty'.

# Fetch the main web site.
wget --no-parent -l0 -r --cut-dirs=1 -nH \
http://www.chiark.greenend.org.uk/~sgtatham/putty/

# Fetch the .htaccess file from the download site, in order to find the
# version number of the latest release.
cd putty
wget http://the.earth.li/~sgtatham/putty/htaccess
version=`sed -n 's!.*http://the.earth.li/~sgtatham/putty/\(.*\)/!\1!p' htaccess`
echo Latest version is $version

# Retrieve the binaries directory for that version from the binaries
# server.
wget --no-parent -l0 -r --cut-dirs=3 -P $version -nH \
http://the.earth.li/~sgtatham/putty/$version/

# Fix the hyperlinks in the download and docs pages so that they point
# to the local mirror of the binaries instead of the primary binaries
# server. Without this there's barely any point in doing the mirror at
# all.
perl -i~ -pe 's!http://the.earth.li/~sgtatham/putty/!!' download.html docs.html

# Create a .htaccess file that supplies the redirection from
# "latest" to a numbered version directory. This RedirectMatch
# command ought to do that job independently of the
echo "RedirectMatch temp ^(.*)/latest(/[^/]*/?[^/]*)?$ \$1/$version\$2" > .htaccess

# The .htaccess file should also ensure the Windows Help files are
# not given any strange MIME types by the web server. Also it
# should make sure the GPG signatures have the correct MIME type.
echo "AddType application/octet-stream .hlp" >> .htaccess
echo "AddType application/octet-stream .cnt" >> .htaccess
echo "AddType application/octet-stream .RSA" >> .htaccess
echo "AddType application/octet-stream .DSA" >> .htaccess

Saluti,

Loading