Release Automation

  • 1.  How to download the file from url in linux

    Posted Oct 16, 2018 02:11 PM

    Hi ,

     

    Can anyone guide me, that how to download the zip file from specified URL eg: Tspace URL in Linux.

    I tried the command ,

     

    wget  -O  myfile.zip   https://URL

    or

    wget   https:URL

     

    But unable to download the complete file and I need to unzip the downloaded file.

    After downloading the file from URL and tried to unzip the file.

    But it is showing an error like this.

     

     

    can anyone Please help me on this to solve it.

     

     

    Thanks in Advance !



  • 2.  Re: How to download the file from url in linux

    Broadcom Employee
    Posted Oct 16, 2018 03:12 PM

    Hi,

     

    I've used wget before. I would think that the command you used should be find. It might be something with the file. I've also used curl to get files using: curl -o /path/of/destination/plus/filename http://url/of/file

     

    Cheers,

    Gregg



  • 3.  Re: How to download the file from url in linux

    Broadcom Employee
    Posted Oct 16, 2018 10:19 PM

    Hi,

     

    Do you mean that the result was outside RA?

    If so, my quick suggestions are:

    - Use http instead of https:    wget http://{URL}

    - Ignore certification:             wget --no-check-certification {URL}

    - Use basic authentication:    wget --http-user={username} --http-passwd={password} {URL}

     

    Regards

    Yas



  • 4.  Re: How to download the file from url in linux

    Broadcom Employee
    Posted Oct 16, 2018 10:56 PM

    good catch, Yas. I didn't even realize the "s". maybe it was a mental block.

    and good point regarding authentication. 

     

    vn00493744

    does it work in a browser? if yes, how does it behave?



  • 5.  Re: How to download the file from url in linux

    Posted Oct 17, 2018 06:38 AM

    Hi Gregg,

     

    If I download the URL file from the browser.It will save it in zip format only.

     

     

    Like this it will show when i try to download in  browser.

     

    But if i use the command

     

    wget -O  /path/destination/file  https://abc.com//URL

     

    I tried curl command also

     

    curl -O /path/destination/file http://abc.com//URL

    got the output as

     

    when trying to unzip the downloaded file.

     

    unzip myzip1.zip

     

     

     

     

    If i mention http in the URL, it is again considering as https in URL.

     

    same error I am getting with both commands.I am not sure why it is unable to unzip the file.

     

     

    Thanks,



  • 6.  Re: How to download the file from url in linux

    Broadcom Employee
    Posted Oct 17, 2018 09:43 AM

    Hello,

     

    A few more questions:

    1. Does it help if you run wget with the --no-check-certification switch that Yas recommended?

    2. If you download the file via the browser and then copy it to your linux/unix machine to run the unzip command against it - does it get the same error?

    3. When downloading via the browser does it prompt you for a user/pass? If not, are you doing it from a machine logged into a domain that it could possibly be using those credentials? Do you have a machine not on the domain that you can try downloading the file with? We aren't suggesting that every https site needs a username/password. But sometimes things like single sign-on might hide authentication that is taking place which is an important detail for wget and/or curl.

    4. If you check its md5 on windows where you download it via the browser and compare it to the md5 on unix/linux, do they match? If so then it sounds as though the integrity of the file is intact. In that case I'd lean towards it being a problem with the program extracting the file and its compatibility with the program/format used to originally create the zip archive.

     

    Regards,
    Gregg



  • 7.  Re: How to download the file from url in linux

    Posted Oct 17, 2018 11:24 AM

    Hi  Gregg,

     

    for

    1. yes checked now with wget --no-check-certification command but still getting an same error.

    2. yes getting same error when i downloaded the zip file from browser and linux as well. After dowloading and i tried to unzip the files in bothy ways getting an error.

    3.But it is not asking any credentials to login.directly it is downloading.I will try with credentianls on URL

    4.md5 command i checked for both files which we downloaded from briowser and Linux.its not matching.it is different.

     

    some random example zip file i downloaded form the URL and checked md5 above.

     

     

    checksum of the file which downloaded from wget command.

     

    so both are not same.

     

    can u please suggest me for further.

     

    Thanks,



  • 8.  Re: How to download the file from url in linux
    Best Answer

    Broadcom Employee
    Posted Oct 22, 2018 10:54 PM

    Hi,

     

    Did you point specified file name as URL?

     

    I tried to use wget command like following. I generated the zip file before run the command.

    wget -O ./a.zip http://<NAC>:8080/log_collector/xxxxx.zip

     

     

    a.zip file can be unzipped properly.

    If you want to download a folder instead of zip file, I suppose you need to set -r option.

    Please check "man wget" command.

     

    At least, your problem is not related to CA products because you said that MD5 was not matched.

    I recommend to discuss with your system administrator.

     

    Thanks

    Yas