Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo
-
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?
-
@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
-
@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?
-
@Russ #!/bin/bash
touch .Xauthority
xauth merge ~pi/.Xauthority
export DISPLAY=:0.0
/home/pi/TonyPi/Functions/Follow.py -
@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.pyI 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.
-
Tentei nessa forma que você me mandou mas ainda não funcionou, Criei os dois Script um Python3 (Python3) e outro bash (Me-Siga)
-
{"trigger":"Me-Siga","command":"/home/pi/TonyPi/Functions/Me-Siga.sh >> /tmp/Me-Siga.log 2>&1","ground":"background","voice":"Me-Siga","allowParams": "false"},
-
@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 +
-
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:
-
Todos os outros comandos dessa pasta ( Functions ) funciona ´só esse Follow que quando clico no botão verde Trigger ele não responde
-
-
@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
-
@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 inexistenteExecutei o comando no terminal shell
-
@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. -
@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 -
@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. -
@Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:
cat /tmp/Me-Siga.log
Também quando executo esse comando: cat /tmp/Me-Siga.log recebo isso: Me-Siga.sh script ran.
-
@Antonio-Francisco-S-Santos, good, so this line that you added to your script
echo "Me-Siga.sh script ran." >> /tmp/Me-Siga.log
Must have writen this to your /tmp/Me-Siga.log file:
Me-Siga.sh script ran.
Did it add that line when your ran the script manually as root? Or when you ran it via TRIGGERcmd? If you don't know, can you test that? Just cat the log before and after you run it.
I just want to establish whether TRIGGERcmd is running your script or not before troubleshooting the content of your script.
-
@Russ Bom dia Professor, Ainda não conseguir resolver o Script com esse arquivo0 (Follow.py) Se os outros funcionam perfeitamente. Quando pego o Script que criei (Me-siga.sh) e modifico para outro arquivo no Trigger deixando assim: (/home/pi/TonyPi/Functions/Buzeer.py) ele funciona mas quando deixo assim: (/home/pi/TonyPi/Functions/Follow.py) não responde.
esse é o Arquivo Follow.py:
-
@Antonio-Francisco-S-Santos, I don't know why that particular python script won't work. I would have to see the output to troubleshoot it.
For some reason sending the output to a log didn't work, but if you run it manually, do you get any output you could send me?
Or is it the same error you got with the KickBall.py script?
Can't initialize GTK backend in function 'cvInitSystem'