<div><div dir="auto">Questa mi sembra una gran baggianata come tutte quelle prima.</div><div dir="auto">Non ho mai usato netcat ma non vedo perché dovrebbe far così.</div><br><div class="gmail_quote"><div>Il giorno ven 29 dic 2017 alle 16:09 Sandro Andreini <<a href="mailto:sandro.andreini@libero.it">sandro.andreini@libero.it</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_-6315850575014337687moz-cite-prefix">Sicuramente stavo sbagliando il modo di
      usare netcat.<br>
      Seguendo il consiglio di Vanni e cioè usare echo ....| netcat
      ..... lo script funziona.<br>
      Quindi probabilmente dentro un file sh non si può usare il comando
      cat o almeno questo non passa le informazioni in pipe a netcat.</div></div><div text="#000000" bgcolor="#FFFFFF"><div class="m_-6315850575014337687moz-cite-prefix"><br>
      <br>
      Il 29/12/2017 16.04, Michele Venturi ha scritto:<br>
    </div></div><div text="#000000" bgcolor="#FFFFFF">
    <blockquote type="cite">
      <div>
        <div>Alla fine della solita baraonda di chi cerca di fare le
          cose nel modo sbagliato il risultato è che bastava tu
          cambiassi le tue aspettative oppure c’era davvero qualche
          problema tecnico? Ancora non è chiaro.</div>
      </div>
      <div><br>
        <div class="gmail_quote">
          <div>Il giorno ven 29 dic 2017 alle 15:55 alessio chemeri <<a href="mailto:alessio.chemeri@gmail.com" target="_blank">alessio.chemeri@gmail.com</a>>
            ha scritto:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="auto">Cacchio mi era scappata eheh
              <div dir="auto"><br>
              </div>
            </div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">Il 28 dic 2017 8:01 PM, "Michele
                Venturi" <<a href="mailto:dardo82@gmail.com" target="_blank">dardo82@gmail.com</a>>
                ha scritto:<br type="attribution">
                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div>
                    <div dir="auto">RTFM! 8-P</div>
                    <br>
                    <div class="gmail_quote">
                      <div>Il giorno gio 28 dic 2017 alle 19:32 alessio
                        chemeri <<a href="mailto:alessio.chemeri@gmail.com" target="_blank">alessio.chemeri@gmail.com</a>>
                        ha scritto:<br>
                      </div>
                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Il 28 dicembre 2017
                        19:17, Sandro Andreini <<a href="mailto:sandro.andreini@libero.it" target="_blank">sandro.andreini@libero.it</a>><br>
                        ha scritto:<br>
                        > Niente di così trascendentale......<br>
                        > Semplicemente devo mandare un comando ad
                        una scheda rele via tcp<br>
                        > Questo comando fa chiudere il rele per 1
                        secondo e poi lo riapre.....<br>
                        > Ho provato a creare lo script come
                        suggerito da Alessio ma sembra non<br>
                        > funzionare.<br>
                        > Sicuramente sto sbagliando qualcosa perchè
                        in relatà quando do il comando<br>
                        > ./nomescript.sh sembra faccia qualcosa ma
                        il rele non si attiva.<br>
                        > Ora verifico.<br>
                        <br>
                        guarda che il path sia corretto, considera che
                        se lo lanci da remoto<br>
                        puoi aver problemi<br>
                        ad accedere al file comandi.txt<br>
                        un suggerimento spensierato,<br>
                        quando fai script anche semplici, fai che
                        lascino un log di quello che<br>
                        fanno nella zona<br>
                        /var/log<br>
                        o dove cacchio vuoi tu, perchè se qualcosa
                        funziona o non funziona<br>
                        altrimenti ti ci<br>
                        vuole un genio alla piccardi per capirlo, e
                        magari ti risponde rtfm :D<br>
                        <br>
                        invece se ti scrivi i log passo passo ogni
                        problema è facilmente ritrovabile...<br>
                        di solito..<br>
                        <br>
                        <br>
                        <br>
                        > Per il momento grazie a tutti.<br>
                        > Sandro<br>
                        ><br>
                        > Il 28/12/2017 18.59, alessio chemeri ha
                        scritto:<br>
                        >><br>
                        >> qualcosa ho capito,<br>
                        >> anche se non ho capito cosa hai nel
                        file comandi.txt<br>
                        >><br>
                        >> detto questo, fare uno script in sh non
                        è cosi' complicato, o meglio non è<br>
                        >> complicato fare quelli semplici come
                        sembrerebbe il tuo.<br>
                        >><br>
                        >> io ti consiglio di dare un occhiata
                        alla roba che ha scritto il piccardi<br>
                        >> <a href="http://gapil.gnulinux.it/download/" rel="noreferrer" target="_blank">http://gapil.gnulinux.it/download/</a><br>
                        >><br>
                        >> è un po' anzianotto (il piccardi
                        eheheh) ma a mio parere (e non conto un<br>
                        >> cazzaccio nulla) è un'ottima lettura.<br>
                        >><br>
                        >><br>
                        >> altrimenti..<br>
                        >><br>
                        >> vi scriptone.sh<br>
                        >><br>
                        >><br>
                        >> #!/bin/sh<br>
                        >> #Questo è uno scriptone<br>
                        >><br>
                        >> cat path_to_comandi/comandi.txt   |
                        netcat blablabla portablabla<br>
                        >><br>
                        >><br>
                        >><br>
                        >><br>
                        >> lo rendi eseguibile...<br>
                        >> provi..<br>
                        >><br>
                        >><br>
                        >> Il 28 dicembre 2017 18:32, Sandro
                        Andreini <<a href="mailto:sandro.andreini@libero.it" target="_blank">sandro.andreini@libero.it</a>><br>
                        >> ha scritto:<br>
                        >>><br>
                        >>> Ok scusate per il mio caos.<br>
                        >>> Ho necessità di inviare ad una
                        scheda dei comandi che sono dentro il file<br>
                        >>> comandi.txt.<br>
                        >>> Per inviare questi comandi devo
                        usare la sintassi cat comandi.txt |<br>
                        >>> netcat<br>
                        >>> 192.168.1.100 6722<br>
                        >>> Se uso questo comando da shell
                        funziona regolarmente.<br>
                        >>> Dentro comandi.txt in realtà non
                        c'è niente altro che: 11*<br>
                        >>> A questo punto ho bisogno di creare
                        un file .sh che posso richiamare da<br>
                        >>> Domoticz che è un server di
                        domotica.<br>
                        >>> Spero di essere stato più chiaro.<br>
                        >>> Grazie a tutti.<br>
                        >>> Sandro<br>
                        >>><br>
                        >>><br>
                        >>> Il 28/12/2017 18.14, Michele
                        Venturi ha scritto:<br>
                        >>><br>
                        >>> Spiegati meglio; ci servono il
                        contesto ed i dettagli...<br>
                        >>><br>
                        >>> Il giorno gio 28 dic 2017 alle
                        18:04 alessio chemeri<br>
                        >>> <<a href="mailto:alessio.chemeri@gmail.com" target="_blank">alessio.chemeri@gmail.com</a>>
                        ha scritto:<br>
                        >>>><br>
                        >>>> mi accodo a peter,<br>
                        >>>> non sei stato molto chiaro
                        nella richiesta.<br>
                        >>>><br>
                        >>>> Se hai il file cmandi.txt puoi
                        passarlo come parametro e trattarlo<br>
                        >>>> come tale nello script interno,
                        ma<br>
                        >>>> devi dare il percorso (path)
                        completo.<br>
                        >>>><br>
                        >>>><br>
                        >>>> Il 28 dicembre 2017 17:29,
                        peterpunk <<a href="mailto:peterpunk@hackbloc.it" target="_blank">peterpunk@hackbloc.it</a>>
                        ha scritto:<br>
                        >>>>><br>
                        >>>>> On Thu, 28 Dec 2017
                        16:08:17 +0100 Sandro wrote:<br>
                        >>>>><br>
                        >>>>>> Salve a tutti e a tutti
                        auguri di buone feste.<br>
                        >>>>>> Mi rivolgo a voi per
                        chiedere lumi su una cosa per voi sicuramente<br>
                        >>>>>> banale. Ho necessità di
                        creare uno script nel quale devo inserire<br>
                        >>>>>> i seguenti comandi che
                        da shell funzionano correttamente.<br>
                        >>>>>><br>
                        >>>>>> cat comandi.txt |
                        netcat 192.168.1.100 6722<br>
                        >>>>>><br>
                        >>>>>> Ovviamente è presente
                        un file denominato comandi.txt ma non ho<br>
                        >>>>>> idea di come inserire
                        questi comandi in uno scrpt sh.<br>
                        >>>>>><br>
                        >>>>> Io... Non ho capito bene la
                        domanda :-(<br>
                        >>>>> Vuoi inserire nello script
                        i comandi elencati (a modino) nel file<br>
                        >>>>> `comandi.txt'?<br>
                        >>>>><br>
                        >>>>> . comandi.txt<br>
                        >>>>><br>
                        >>>>> Il punto iniziale indica a
                        bash di acquisire il contenuto del file di<br>
                        >>>>> testo specificato dopo lo
                        spazio; se quest'ultimo non risiede nella<br>
                        >>>>> medesima directory dello
                        script, allora dovrai specificare anche il<br>
                        >>>>> percorso per raggiungerlo.<br>
                        >>>>> --<br>
                        >>>>><br>
                        >>>>>   ,= ,-_-. =.<br>
                        >>>>> ((_/)o o(\_))<br>
                        >>>>>   `-'(. .)`-'<br>
                        >>>>>       \_/     printf("Mai
                        un giorno senza una riga\n");<br>
                        >>>>>
                        _______________________________________________<br>
                        >>>>> flug mailing list<br>
                        >>>>> <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        >>>>> <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                        >>>><br>
                        >>>>
                        _______________________________________________<br>
                        >>>> flug mailing list<br>
                        >>>> <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        >>>> <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                        >>><br>
                        >>> --<br>
                        >>> --<br>
                        >>> <a href="http://profiles.google.com/dardo82" rel="noreferrer" target="_blank">http://profiles.google.com/dardo82</a><br>
                        >>><br>
                        >>><br>
                        >>><br>
                        >>>
                        _______________________________________________<br>
                        >>> flug mailing list<br>
                        >>> <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        >>> <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                        >>><br>
                        >>><br>
                        >>><br>
                        >>>
                        _______________________________________________<br>
                        >>> flug mailing list<br>
                        >>> <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        >>> <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                        >><br>
                        >>
                        _______________________________________________<br>
                        >> flug mailing list<br>
                        >> <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        >> <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                        ><br>
                        ><br>
                        ><br>
                        >
                        _______________________________________________<br>
                        > flug mailing list<br>
                        > <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        > <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                        _______________________________________________<br>
                        flug mailing list<br>
                        <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                        <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a></blockquote>
                    </div>
                  </div>
                  <div>-- <br>
                  </div>
                  <div class="m_-6315850575014337687m_6936594662966262389m_1603098446243584863gmail_signature" data-smartmail="gmail_signature">
                    <div>
                      <div>--</div>
                      <a href="http://profiles.google.com/dardo82" target="_blank">http://profiles.google.com/dardo82</a>
                      <div><br>
                      </div>
                    </div>
                  </div>
                  <br>
                  _______________________________________________<br>
                  flug mailing list<br>
                  <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                  <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a><br>
                </blockquote>
              </div>
            </div>
            _______________________________________________<br>
            flug mailing list<br>
            <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
            <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a></blockquote>
        </div>
      </div>
      <div>-- <br>
      </div>
      <div class="m_-6315850575014337687gmail_signature" data-smartmail="gmail_signature">
        <div>
          <div>--</div>
          <a href="http://profiles.google.com/dardo82" target="_blank">http://profiles.google.com/dardo82</a>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="m_-6315850575014337687mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
flug mailing list
<a class="m_-6315850575014337687moz-txt-link-abbreviated" href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a>
<a class="m_-6315850575014337687moz-txt-link-freetext" href="https://lists.linux.it/listinfo/flug" target="_blank">https://lists.linux.it/listinfo/flug</a></pre>
    </blockquote>
    <p><br>
    </p>
  </div>

_______________________________________________<br>
flug mailing list<br>
<a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
<a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/flug</a></blockquote></div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>--</div><a href="http://profiles.google.com/dardo82" target="_blank">http://profiles.google.com/dardo82</a><div><br></div></div></div>