Find the answer to your Linux question:
Results 1 to 6 of 6
i need to sync a file on a desktop (SLED 11) from an ftp server (windows FTP) is it possible to use rsync for the same? Code: sled1:~ # rsync ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Location
    navi mumbai, india
    Posts
    41

    Question sync file from ftp server to desktop

    i need to sync a file on a desktop (SLED 11) from an ftp server (windows FTP)

    is it possible to use rsync for the same?

    Code:
    sled1:~ # rsync ftp://192.168.5.215/pam_mount.conf.xml /etc/security/
    ssh: Could not resolve hostname ftp: Name or service not known
    rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
    rsync error: unexplained error (code 255) at io.c(632) [receiver=3.0.4]
    sled1:~ # man rsync
    sled1:~ #
    i tried using wget

    the wget ftp://192.168.5.215/pam_mount.conf.xml /etc/security/pam_mount.conf.xml
    does fetch the file from the ftp server...to /etc/security but if i create a cron job to fetch the file regularly from the FTP server then it creates files like

    /etc/security/pam_mount.conf.xml1
    /etc/security/pam_mount.conf.xml2
    /etc/security/pam_mount.conf.xml3

    which i dont want. i dont see an option in wget man pages as to overwrite if a file already exists

    please help

  2. #2
    Linux Guru
    Join Date
    Jan 2009
    Location
    Dover, NH
    Posts
    1,633
    If you are the admin of the Windows server, it is posible to use rsync on it (as an rsync server via cigwin).

    Otherwise, there is a little program (perl script) in the repositories called mirror.

    Software.openSUSE.org

    Edit: You can also look at emirror towards the bottom.

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Quote Originally Posted by iinfi View Post
    i tried using wget

    the wget ftp://192.168.5.215/pam_mount.conf.xml /etc/security/pam_mount.conf.xml
    does fetch the file from the ftp server...to /etc/security but if i create a cron job to fetch the file regularly from the FTP server then it creates files like

    /etc/security/pam_mount.conf.xml1
    /etc/security/pam_mount.conf.xml2
    /etc/security/pam_mount.conf.xml3

    which i dont want. i dont see an option in wget man pages as to overwrite if a file already exists
    Code:
    man wget
    
    -nc
    --no-clobber
        If a file is downloaded more than once in the same directory, Wget's behavior depends on a few options, including -nc. In certain cases, the local file will be clobbered, or overwritten, upon repeated download. In other cases it will be preserved.
    
        When running Wget without -N, -nc, or -r, downloading the same file in the same directory will result in the original copy of file being preserved and the second copy being named file.1. If that file is downloaded yet again, the third copy will be named file.2, and so on. When -nc is specified, this behavior is suppressed, and Wget will refuse to download newer copies of file. Therefore, ''"no-clobber"'' is actually a misnomer in this mode---it's not clobbering that's prevented (as the numeric suffixes were already preventing clobbering), but rather the multiple version saving that's prevented.
    
        When running Wget with -r, but without -N or -nc, re-downloading a file will result in the new copy simply overwriting the old. Adding -nc will prevent this behavior, instead causing the original version to be preserved and any newer copies on the server to be ignored.
    
        When running Wget with -N, with or without -r, the decision as to whether or not to download a newer copy of a file depends on the local and remote timestamp and size of the file. -nc may not be specified at the same time as -N.
    
        Note that when -nc is specified, files with the suffixes .html or .htm will be loaded from the local disk and parsed as if they had been retrieved from the Web.

  4. #4
    Just Joined!
    Join Date
    Mar 2008
    Location
    navi mumbai, india
    Posts
    41
    i had seen the no clobber option but that seems to skip downloading the file from the ftp site if a file already exists in that location.
    so if i update the file at the ftp server it will not be downloaded on my machine as it is already present at that location.

    if i use the option -O
    wget ftp://192.168.5.215/pam_mount.conf.xml -O /etc/security/pam_mount.conf.xml

    it seems to work the way i want ..thank you

  5. #5
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Code:
    man wget
    
    When running Wget with -r, but without -N or -nc, re-downloading a file will result in the new copy simply overwriting the old. Adding -nc will prevent this behavior, instead causing the original version to be preserved and any newer copies on the server to be ignored.
    When running Wget with -r, but without -N or -nc, re-downloading a file will result in the new copy simply overwriting the old.

  6. #6
    Just Joined!
    Join Date
    Mar 2008
    Location
    navi mumbai, india
    Posts
    41
    wonder how i overlook things like this .... no excuse.
    will try it in office tomorrow

    thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...