Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Hi, I got a Suse 10.1 server and a 50gb remote ftp backup space. What I need a is a shell script that will sync my home folder and it's ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    8

    Arrow Need a simple sync via FTP shell script

    Hi,
    I got a Suse 10.1 server and a 50gb remote ftp backup space.
    What I need a is a shell script that will sync my home folder and it's sub directories while excluding some directories (due to size) to that remote FTP.

    Anyone has such a shell script he/she can share?

    Thanks!

  2. #2
    jls
    jls is offline
    Just Joined!
    Join Date
    Apr 2007
    Posts
    13
    Install lftp and create a cron job that looks something like this:
    Code:
    0 15 * * 0-5 lftp -f /<path>/<to>/list.x
    Then create the /<path>/<to>/list.x file to look something like this:
    Code:
    open sftp://<username>:<password>@<ip address>
    mirror -c /<path to source on remote host> /<path to destination on local host>
    exit

  3. #3
    Just Joined!
    Join Date
    Jun 2007
    Posts
    8

    Thanks

    So if I get it right the source folder is my server and the destination one is the backup ftp server?

    Also - will this run recursively on the sub folders?
    and how do I exclude some of the sub folders?

    And another "stupid question": if my ftp password contains "@" in it. How do I pu that in the ftp connection string so that the server knows it's part of the password?

  4. #4
    jls
    jls is offline
    Just Joined!
    Join Date
    Apr 2007
    Posts
    13
    Yes source directory is the server to be backed up and destination is the server to which you are backing up. The script runs on the latter.

    It will mirror the directories recursively yes.
    You can exclude files using the -x or -X option. check the man page for syntax...it will even take regular expressions or globs.

    Not to sure about the @ question though....uhm maybe try and play around with masking it with a backslash like this:
    p\@ssword

    Or else try and use single qoutes 'p@ssword' (hope that's not really your password

    Third option is to change your password....will probably be the quickest.

  5. #5
    Just Joined!
    Join Date
    Jun 2007
    Posts
    8

    Thanks

    Thanks Jis,
    Well I can't change the pwd as it's 3rd party assigned.
    I also can't run the script on the target destination server as it's a nas shared backup one. I can only run it on my own machine (source).

    Will that work?
    Also - where and how can I install lftp on Suse?

  6. #6
    jls
    jls is offline
    Just Joined!
    Join Date
    Apr 2007
    Posts
    13
    Yes it should work either way around but I think your password might be a bit of a challenge. Have you looked at rsync? You can run it through an SSH tunnel so it will synch local and remote directories securely.
    You can install lft from the SuSE CD's using YAST

  7. #7
    Just Joined!
    Join Date
    Jun 2007
    Posts
    8
    Hi,
    Yeh - I've asked the backup owners and they don't support RSH so no rsync
    About the lftp - I'll give it a try now - thanks!

  8. #8
    jls
    jls is offline
    Just Joined!
    Join Date
    Apr 2007
    Posts
    13
    They Shouldn't support RSH! it is insecure. You will need SSH .

  9. #9
    Just Joined!
    Join Date
    Jun 2007
    Posts
    8
    Found it - thanks

  10. #10
    Just Joined!
    Join Date
    Jun 2007
    Posts
    8
    Ok,
    Need some help.
    I got a cron doing:
    lftp -f /mirror.x

    Then the mirror.x file:
    open ftp://myuser:mypass@mybackupftp_ip
    mirror -c / --exclude /var/www/vhosts/Mysite.com/httpdocs/files
    exit

    It just doesn't copy a thing.
    If I take out the exclude it works but doesn't exclude.

    I tried with -x and also changing the position of the / in the command with no change.

    (I want to backup all BUT the that folder specified above).

    Any ideas?

Page 1 of 2 1 2 LastLast

Posting Permissions

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