Cron Job to move files from one server to another - files + db if possible

Discussion in 'PHP' started by Sugavanas, Feb 14, 2014.

  1. #1
    I've got some files which are uploaded to an FTP server, and I need to transfer them to another FTP server on a regular basis.

    I have plesk installed on my server and would like it to do cron jobs and transfer files to another server through ftp. Like 3 days once maybe.

    I know it can be done through wget command. But i need it to be automated a little bit.

    I also want to know if there is a way to back up databases and send it as well.

    I see there is a way though plesk control panel to do it, but i still wish to do it outside plesk in other servers as well
     
    Sugavanas, Feb 14, 2014 IP
  2. livedating

    livedating Active Member

    Messages:
    161
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    83
    #2
    If you are looking for scripting solution then you can try ncftp: http://www.ncftp.com/ncftp/
    It can upload/download bulk files via ftp automatically, i.e. started from a shell script.
    Example:
    #!/bin/sh
    
    ncftpput -u myusername -p mypassword -R target-host.com /target/directory/ /source/directory/
    
    Code (markup):
    -R means "recursively" i.e. all nested files and directories

    More options are described here: http://www.ncftp.com/ncftp/doc/ncftpput.html
     
    Last edited: Feb 14, 2014
    livedating, Feb 14, 2014 IP
  3. Sugavanas

    Sugavanas Well-Known Member

    Messages:
    688
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    170
    #3
    I will try it and give you the results :D
     
    Sugavanas, Feb 14, 2014 IP