• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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
6.6k
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.
  • A
    Antonio Francisco S.Santos @Antonio Francisco S.Santos
    last edited by Feb 4, 2023, 1:55 PM

    @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

    R 1 Reply Last reply Feb 4, 2023, 5:10 PM Reply Quote 0
    • R
      Russ @Antonio Francisco S.Santos
      last edited by Feb 4, 2023, 5:10 PM

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

      Russell VanderMey

      A 1 Reply Last reply Feb 8, 2023, 9:15 PM Reply Quote 0
      • A
        Antonio Francisco S.Santos @Russ
        last edited by Feb 8, 2023, 9:15 PM

        @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.

        R 1 Reply Last reply Feb 9, 2023, 2:07 AM Reply Quote 0
        • R
          Russ @Antonio Francisco S.Santos
          last edited by Feb 9, 2023, 2:07 AM

          @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
          • A
            Antonio Francisco S.Santos
            last edited by Feb 10, 2023, 1:17 AM

            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?

            R A 2 Replies Last reply Feb 10, 2023, 2:07 PM Reply Quote 0
            • R
              Russ @Antonio Francisco S.Santos
              last edited by Russ Feb 10, 2023, 7:20 PM Feb 10, 2023, 2:07 PM

              @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

              A 1 Reply Last reply Feb 15, 2023, 1:28 AM Reply Quote 0
              • A
                Antonio Francisco S.Santos @Antonio Francisco S.Santos
                last edited by Feb 15, 2023, 1:22 AM

                @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
                • A
                  Antonio Francisco S.Santos @Russ
                  last edited by Feb 15, 2023, 1:28 AM

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

                  R 1 Reply Last reply Feb 15, 2023, 2:17 AM Reply Quote 0
                  • R
                    Russ @Antonio Francisco S.Santos
                    last edited by Russ Feb 15, 2023, 2:18 AM Feb 15, 2023, 2:17 AM

                    @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
                    • A
                      Antonio Francisco S.Santos
                      last edited by Feb 16, 2023, 12:56 AM

                      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
                      • A
                        Antonio Francisco S.Santos
                        last edited by Feb 16, 2023, 1:01 AM

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

                        R 1 Reply Last reply Feb 16, 2023, 1:48 AM Reply Quote 0
                        • R
                          Russ @Antonio Francisco S.Santos
                          last edited by Feb 16, 2023, 1:48 AM

                          @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
                          • A
                            Antonio Francisco S.Santos
                            last edited by Feb 16, 2023, 7:59 PM

                            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
                            • A
                              Antonio Francisco S.Santos
                              last edited by Feb 16, 2023, 8:02 PM

                              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
                              • A
                                Antonio Francisco S.Santos
                                last edited by Feb 16, 2023, 10:57 PM

                                Log.jpg

                                R 1 Reply Last reply Feb 16, 2023, 11:00 PM Reply Quote 0
                                • R
                                  Russ @Antonio Francisco S.Santos
                                  last edited by Russ Feb 16, 2023, 11:01 PM Feb 16, 2023, 11:00 PM

                                  @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
                                  • A
                                    Antonio Francisco S.Santos
                                    last edited by Feb 16, 2023, 11:46 PM

                                    @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

                                    R 1 Reply Last reply Feb 17, 2023, 12:05 AM Reply Quote 0
                                    • R
                                      Russ @Antonio Francisco S.Santos
                                      last edited by Feb 17, 2023, 12:05 AM

                                      @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
                                      • A
                                        Antonio Francisco S.Santos
                                        last edited by Feb 17, 2023, 12:53 AM

                                        @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
                                        • A
                                          Antonio Francisco S.Santos
                                          last edited by Feb 17, 2023, 12:56 AM

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

                                          /root/.TRIGGERcmdData/commands.json, ground = background.

                                          não da permissão quando executo esse comando:
                                          /root/.TRIGGERcmdData/commands.json, ground = background.

                                          1 Reply Last reply Reply Quote 0
                                          31 out of 80
                                          • First post
                                            31/80
                                            Last post