wget, logging the output and the response

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I calling an url using wget. This url gives me a response, its a Message id. I want to write the logs to a log file, with the message id as well. Also the log should be appended each time. I trying to do it in my shell script.



Is it possible to do this? If so how can i do it.










share|improve this question





















  • Did you already try using wget's --append-output=logfile (-a logfile) option? It looks like it is precisely what you would need.
    – Emeric
    Aug 4 '15 at 6:58










  • @Emeric I have tried that it works fine for writing the output to the file. I also want the response to be written to the same file after the output. I need help with this.
    – Ace
    Aug 4 '15 at 7:04














up vote
0
down vote

favorite












I calling an url using wget. This url gives me a response, its a Message id. I want to write the logs to a log file, with the message id as well. Also the log should be appended each time. I trying to do it in my shell script.



Is it possible to do this? If so how can i do it.










share|improve this question





















  • Did you already try using wget's --append-output=logfile (-a logfile) option? It looks like it is precisely what you would need.
    – Emeric
    Aug 4 '15 at 6:58










  • @Emeric I have tried that it works fine for writing the output to the file. I also want the response to be written to the same file after the output. I need help with this.
    – Ace
    Aug 4 '15 at 7:04












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I calling an url using wget. This url gives me a response, its a Message id. I want to write the logs to a log file, with the message id as well. Also the log should be appended each time. I trying to do it in my shell script.



Is it possible to do this? If so how can i do it.










share|improve this question













I calling an url using wget. This url gives me a response, its a Message id. I want to write the logs to a log file, with the message id as well. Also the log should be appended each time. I trying to do it in my shell script.



Is it possible to do this? If so how can i do it.







bash shell-script logs wget output






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 4 '15 at 6:52









Ace

10315




10315











  • Did you already try using wget's --append-output=logfile (-a logfile) option? It looks like it is precisely what you would need.
    – Emeric
    Aug 4 '15 at 6:58










  • @Emeric I have tried that it works fine for writing the output to the file. I also want the response to be written to the same file after the output. I need help with this.
    – Ace
    Aug 4 '15 at 7:04
















  • Did you already try using wget's --append-output=logfile (-a logfile) option? It looks like it is precisely what you would need.
    – Emeric
    Aug 4 '15 at 6:58










  • @Emeric I have tried that it works fine for writing the output to the file. I also want the response to be written to the same file after the output. I need help with this.
    – Ace
    Aug 4 '15 at 7:04















Did you already try using wget's --append-output=logfile (-a logfile) option? It looks like it is precisely what you would need.
– Emeric
Aug 4 '15 at 6:58




Did you already try using wget's --append-output=logfile (-a logfile) option? It looks like it is precisely what you would need.
– Emeric
Aug 4 '15 at 6:58












@Emeric I have tried that it works fine for writing the output to the file. I also want the response to be written to the same file after the output. I need help with this.
– Ace
Aug 4 '15 at 7:04




@Emeric I have tried that it works fine for writing the output to the file. I also want the response to be written to the same file after the output. I need help with this.
– Ace
Aug 4 '15 at 7:04










3 Answers
3






active

oldest

votes

















up vote
0
down vote



accepted










wget -O - $url --append-output=logfile >> logfile


Specifying - as filename for -O writes the output to stdout.



My shell does not hate using logfile for both append operations. It might work for you as well.






share|improve this answer




















  • It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
    – Ace
    Aug 4 '15 at 7:21










  • You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
    – Emeric
    Aug 4 '15 at 14:49

















up vote
0
down vote













I found a work around



wget --no-check-certificate -O contnt -a logfile $url
cat contnt >> logfile
rm contnt


is there any other better way of doing this which doesnt include reading from the file and deleting the file?






share|improve this answer



























    up vote
    0
    down vote













    You can do it like this:



    wget - $url --server-response --append-output=logfile




    share








    New contributor




    Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f220070%2fwget-logging-the-output-and-the-response%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote



      accepted










      wget -O - $url --append-output=logfile >> logfile


      Specifying - as filename for -O writes the output to stdout.



      My shell does not hate using logfile for both append operations. It might work for you as well.






      share|improve this answer




















      • It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
        – Ace
        Aug 4 '15 at 7:21










      • You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
        – Emeric
        Aug 4 '15 at 14:49














      up vote
      0
      down vote



      accepted










      wget -O - $url --append-output=logfile >> logfile


      Specifying - as filename for -O writes the output to stdout.



      My shell does not hate using logfile for both append operations. It might work for you as well.






      share|improve this answer




















      • It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
        – Ace
        Aug 4 '15 at 7:21










      • You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
        – Emeric
        Aug 4 '15 at 14:49












      up vote
      0
      down vote



      accepted







      up vote
      0
      down vote



      accepted






      wget -O - $url --append-output=logfile >> logfile


      Specifying - as filename for -O writes the output to stdout.



      My shell does not hate using logfile for both append operations. It might work for you as well.






      share|improve this answer












      wget -O - $url --append-output=logfile >> logfile


      Specifying - as filename for -O writes the output to stdout.



      My shell does not hate using logfile for both append operations. It might work for you as well.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Aug 4 '15 at 7:14









      Emeric

      793310




      793310











      • It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
        – Ace
        Aug 4 '15 at 7:21










      • You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
        – Emeric
        Aug 4 '15 at 14:49
















      • It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
        – Ace
        Aug 4 '15 at 7:21










      • You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
        – Emeric
        Aug 4 '15 at 14:49















      It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
      – Ace
      Aug 4 '15 at 7:21




      It works like a charm, Thanks, but is there a way to have the response after the output instead of the with the output.
      – Ace
      Aug 4 '15 at 7:21












      You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
      – Emeric
      Aug 4 '15 at 14:49




      You can try using -nv, --no-verbose option. It reduces the -a part to a single line, but that single line can only be displayed after the requested contents have been retrieved (and therefore written to the logfile) since it also records whether the retrieval was successful.
      – Emeric
      Aug 4 '15 at 14:49












      up vote
      0
      down vote













      I found a work around



      wget --no-check-certificate -O contnt -a logfile $url
      cat contnt >> logfile
      rm contnt


      is there any other better way of doing this which doesnt include reading from the file and deleting the file?






      share|improve this answer
























        up vote
        0
        down vote













        I found a work around



        wget --no-check-certificate -O contnt -a logfile $url
        cat contnt >> logfile
        rm contnt


        is there any other better way of doing this which doesnt include reading from the file and deleting the file?






        share|improve this answer






















          up vote
          0
          down vote










          up vote
          0
          down vote









          I found a work around



          wget --no-check-certificate -O contnt -a logfile $url
          cat contnt >> logfile
          rm contnt


          is there any other better way of doing this which doesnt include reading from the file and deleting the file?






          share|improve this answer












          I found a work around



          wget --no-check-certificate -O contnt -a logfile $url
          cat contnt >> logfile
          rm contnt


          is there any other better way of doing this which doesnt include reading from the file and deleting the file?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 4 '15 at 7:12









          Ace

          10315




          10315




















              up vote
              0
              down vote













              You can do it like this:



              wget - $url --server-response --append-output=logfile




              share








              New contributor




              Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                up vote
                0
                down vote













                You can do it like this:



                wget - $url --server-response --append-output=logfile




                share








                New contributor




                Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.



















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  You can do it like this:



                  wget - $url --server-response --append-output=logfile




                  share








                  New contributor




                  Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  You can do it like this:



                  wget - $url --server-response --append-output=logfile





                  share








                  New contributor




                  Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.








                  share


                  share






                  New contributor




                  Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 9 mins ago









                  Hiccup

                  101




                  101




                  New contributor




                  Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Hiccup is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f220070%2fwget-logging-the-output-and-the-response%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay