Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Cron Job Download New Version of File

Discussion in 'General Discussion' started by Graham Ferguson, Feb 17, 2015.

  1. Graham Ferguson

    Graham Ferguson Registered

    Joined:
    Feb 17, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Dunfermline, Fife, United King
    cPanel Access Level:
    Website Owner
    Hello, I need some help on how to download a file using a cron job.

    I need to download a file from an ftp address on a separate server, get the file and put it in a particular directory on the server. I also only want to grab the file if the version on the FTP server is newer than the version on my server.

    I am currently able to pull the file into the required directory but cannot get it to only do this if the file is newer, the command line I am using is:

    Code:
    wget ftp://ftpaddress/data/item_import_prod_features.txt -O /serveraddress/item_import_prod_features.txt
    Could someone tell me how I can do that please?
     
    #1 Graham Ferguson, Feb 17, 2015
    Last edited by a moderator: Feb 17, 2015
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,896
    Likes Received:
    1,814
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    You could use cURL as documented here:

    cURL - Manual

    Search for the term "remote file is newer" in your browser on the above page to see which commands are available.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice