TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo

    Raspberry Pi
    2
    80
    4.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Antonio Francisco S.SantosA
      Antonio Francisco S.Santos @Russ
      last edited by

      @Russ Bom dia Amigo, montei os doi script como você falou, um com .sh e o outro como já existe .py ai funcionou mas os comando que contem vídeos não abre o vídeo para de punciona logo em seguida e aparece essa respostar ai:
      Unable to init server: Não foi possível conectar: Conexão recusada
      (Frame:2570): Gtk-WARNING **: 10:09:45.448: cannot open display:

      Antonio Francisco S.SantosA 1 Reply Last reply Reply Quote 0
      • Antonio Francisco S.SantosA
        Antonio Francisco S.Santos @Antonio Francisco S.Santos
        last edited by

        @Antonio-Francisco-S-Santos said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

        @Russ Bom dia Amigo, montei os doi script como você falou, um com .sh e o outro como já existe .py ai funcionou mas os comando que contem vídeos não abre o vídeo para de punciona logo em seguida e aparece essa respostar ai:
        Unable to init server: Não foi possível conectar: Conexão recusada
        (Frame:2570): Gtk-WARNING **: 10:09:45.448: cannot open display:

        Consegui resolver Professor depois de muita quebra de cabeça e muito estudo, o Código basch ficou assim:
        #! /bin/bash

        touch .Xauthority

        xauth merge ~pi/.Xauthority

        export DISPLAY=:0.0

        RussR 1 Reply Last reply Reply Quote 0
        • RussR
          Russ @Antonio Francisco S.Santos
          last edited by

          @Antonio-Francisco-S-Santos, awesome. I'm glad you figured it out.

          Russell VanderMey

          Antonio Francisco S.SantosA 1 Reply Last reply Reply Quote 0
          • Antonio Francisco S.SantosA
            Antonio Francisco S.Santos @Russ
            last edited by

            @Russ Olá Professor, Só mais uma pergunta: existe algum limites na quantidade de Script além dos 4 Script que já existe? Porque coloquei mais dois comandos e não faz nada quando clico em Trigger nos dois que acrescentei.

            RussR 1 Reply Last reply Reply Quote 0
            • RussR
              Russ @Antonio Francisco S.Santos
              last edited by

              @Antonio-Francisco-S-Santos, no, there's no limit on the number of commands you can create.

              Does it do anything if you click the green arrow button in the GUI Editor?

              727006cc-f230-45ad-8df2-384b9fb614c1-image.png

              Russell VanderMey

              1 Reply Last reply Reply Quote 0
              • Antonio Francisco S.SantosA
                Antonio Francisco S.Santos
                last edited by

                Olá, Alguns comandos funcionam, mas alguns não faz nada quando clico no botão verde e como faço pra ver o histórico de erro?

                RussR Antonio Francisco S.SantosA 2 Replies Last reply Reply Quote 0
                • RussR
                  Russ @Antonio Francisco S.Santos
                  last edited by Russ

                  @Antonio-Francisco-S-Santos, on Linux, you can send the output of a command to a log file by directing the output to a file.

                  If your command is:

                  ~/script.sh
                  

                  Change your command to this:

                  ~/script.sh >> /tmp/script.log 2>&1
                  

                  Then view the log file like this:

                  cat /tmp/script.log
                  

                  Russell VanderMey

                  Antonio Francisco S.SantosA 1 Reply Last reply Reply Quote 0
                  • Antonio Francisco S.SantosA
                    Antonio Francisco S.Santos @Antonio Francisco S.Santos
                    last edited by

                    @Antonio-Francisco-S-Santos Boa Noite Amigo, os Scripts estão funcionando perfeitamente, mas tem um script que não funciona de maneira alguma já fiz do mesmo jeito que montei os outros mas quando clico nada faz. O que pode ser?

                    1 Reply Last reply Reply Quote 0
                    • Antonio Francisco S.SantosA
                      Antonio Francisco S.Santos @Russ
                      last edited by

                      @Russ #!/bin/bash
                      touch .Xauthority
                      xauth merge ~pi/.Xauthority
                      export DISPLAY=:0.0
                      /home/pi/TonyPi/Functions/Follow.py

                      RussR 1 Reply Last reply Reply Quote 0
                      • RussR
                        Russ @Antonio Francisco S.Santos
                        last edited by Russ

                        @Antonio-Francisco-S-Santos said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

                        touch .Xauthority
                        xauth merge ~pi/.Xauthority
                        export DISPLAY=:0.0
                        /home/pi/TonyPi/Functions/Follow.py

                        I think you should change that first touch line to this:

                        touch ~/.Xauthority
                        

                        That way the .Xauthority file will be created in your user's home folder instead of whatever happens to be the working directory.

                        Did you update the command to capture the output of that script? It would help in troubleshooting to see the output in the log file.

                        Your command would be something like this to produce the /tmp/follow.log file:

                        {"trigger":"Follow","command":"/home/pi/TonyPi/Functions/follow.sh >> /tmp/follow.log 2>&1","ground":"foreground","voice":"follow","allowParams": "false"},
                        

                        I used ground = foreground because I'm assuming you're running foreground triggercmd agent by running it in a terminal window with triggercmdagent --console. Please confirm. If you're running it in the background agent (as root), change ground to background.

                        Russell VanderMey

                        1 Reply Last reply Reply Quote 0
                        • Antonio Francisco S.SantosA
                          Antonio Francisco S.Santos
                          last edited by

                          Tentei nessa forma que você me mandou mas ainda não funcionou, Criei os dois Script um Python3 (Python3) e outro bash (Me-Siga)
                          Imagem3.jpg Imagem2.jpg Imagem1.jpg

                          1 Reply Last reply Reply Quote 0
                          • Antonio Francisco S.SantosA
                            Antonio Francisco S.Santos
                            last edited by

                            {"trigger":"Me-Siga","command":"/home/pi/TonyPi/Functions/Me-Siga.sh >> /tmp/Me-Siga.log 2>&1","ground":"background","voice":"Me-Siga","allowParams": "false"},

                            RussR 1 Reply Last reply Reply Quote 0
                            • RussR
                              Russ @Antonio Francisco S.Santos
                              last edited by

                              @Antonio-Francisco-S-Santos, can you show me the output of these commands?

                              Show the contents of your log file, if it exists:

                              cat /tmp/Me-Siga.log
                              

                              Show the /home/pi/TonyPi/Functions/Me-Siga.sh file's permissions:

                              ls -al /home/pi/TonyPi/Functions/Me-Siga.sh
                              

                              I'd like to see if it's executable. If it's not, you can make it executable with this command:

                              chmod +x /home/pi/TonyPi/Functions/Me-Siga.sh
                              

                              Show whether the background agent is started:

                              systemctl status triggercmdagent
                              

                              Did you run this command already?

                              xhost +
                              

                              Russell VanderMey

                              1 Reply Last reply Reply Quote 0
                              • Antonio Francisco S.SantosA
                                Antonio Francisco S.Santos
                                last edited by

                                Eu já tentei criar o arquivo de log mas não consigo e ao executar esse Script (Me-Siga.sh) aparece a mensagem que não encontrou o arquivo ou arquivo inexistente:
                                Me-Siga.sh2.jpg Me-siga.sh.jpg Follow.py (1).jpg

                                1 Reply Last reply Reply Quote 0
                                • Antonio Francisco S.SantosA
                                  Antonio Francisco S.Santos
                                  last edited by

                                  Todos os outros comandos dessa pasta ( Functions ) funciona ´só esse Follow que quando clico no botão verde Trigger ele não responde

                                  1 Reply Last reply Reply Quote 0
                                  • Antonio Francisco S.SantosA
                                    Antonio Francisco S.Santos
                                    last edited by

                                    Log.jpg

                                    RussR 1 Reply Last reply Reply Quote 0
                                    • RussR
                                      Russ @Antonio Francisco S.Santos
                                      last edited by Russ

                                      @Antonio-Francisco-S-Santos, you still haven't told me if you're getting something in the /tmp/Me-Siga.log file or not.

                                      Before we troubleshoot the script I need to know whether the command is running. If you get something in /tmp/Me-Siga.log then we'll know it is running.

                                      Please run this command and show me the result:

                                      cat /tmp/Me-Siga.log
                                      

                                      Russell VanderMey

                                      1 Reply Last reply Reply Quote 0
                                      • Antonio Francisco S.SantosA
                                        Antonio Francisco S.Santos
                                        last edited by

                                        @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

                                        cat /tmp/Me-Siga.log

                                        Quando executo esse comando aparece essa resposta:
                                        cat: /tmp/Me-Siga.log: Arquivo ou diret▒rio inexistente

                                        Executei o comando no terminal shell

                                        RussR 1 Reply Last reply Reply Quote 0
                                        • RussR
                                          Russ @Antonio Francisco S.Santos
                                          last edited by

                                          @Antonio-Francisco-S-Santos, interresting. It doesn't seem to be running because you aren't getting anything in the log file.

                                          Will you please try running the script as root manually? I'm curious if that works.

                                          sudo su -
                                          /home/pi/TonyPi/Functions/Me-Siga.sh
                                          

                                          Also, please try adding this line to your Me-Siga.sh script:

                                          echo "Me-Siga.sh script ran." >> /tmp/Me-Siga.log
                                          

                                          Also, please confirm:

                                          You ran xhost + as pi.
                                          In your /root/.TRIGGERcmdData/commands.json file, ground = background.

                                          Russell VanderMey

                                          1 Reply Last reply Reply Quote 0
                                          • Antonio Francisco S.SantosA
                                            Antonio Francisco S.Santos
                                            last edited by

                                            @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

                                            /home/pi/TonyPi/Functions/Me-Siga.sh

                                            já executei esse comando como root mas não funcionou: /home/pi/TonyPi/Functions/Me-Siga.sh
                                            também já tentei como comando echo mas não funcionou o Script não responde

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post