Executing command on remote server fails - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Executing command on remote server fails (/showthread.php?tid=5849) |
Executing command on remote server fails - baggins - 17.01.2025 I have two LM4 (firmware 20160714) where I have a simple script that executes a command on a remote server using ssh. This has always worked but now the script fails on one of the LM4. This is the script: Code: function my_telegram_remote(message) When I run this script on the good LM, I can see in the logfile on the remote machine that the connection is established. When I run the script on the other LM nothing shows up in the logfile. I can ping the remote server from this LM. The log(result) returns nothing. Is there a way I can debug this to find out what is going on? RE: Executing command on remote server fails - admin - 17.01.2025 You should check logs on the server side, to see whether LM has connected or not. Check that the message does not contain single quotes or the command will fail. As an alternative you can use HTTP instead of SSH. RE: Executing command on remote server fails - baggins - 17.01.2025 (17.01.2025, 11:49)admin Wrote: You should check logs on the server side, to see whether LM has connected or not. Check that the message does not contain single quotes or the command will fail. As an alternative you can use HTTP instead of SSH. Nothing shows in the logfile of the remote server. So it looks like it doesn't connect... Can you give an example of doing this with http, so I could try this? Thanks. RE: Executing command on remote server fails - admin - 17.01.2025 You can run a HTTP server or even a simple TCP server that will forward messages to telegram as needed. You can use any programming language to implement this. Don't forget to run this server automatically when the system starts. RE: Executing command on remote server fails - baggins - 17.01.2025 (17.01.2025, 12:19)admin Wrote: You can run a HTTP server or even a simple TCP server that will forward messages to telegram as needed. You can use any programming language to implement this. Don't forget to run this server automatically when the system starts. I'm not quite sure I understand. Where would I have to run this HTTP server? On the remote server that I now ssh to there runs already an http server. How do I get it to forward messages to telegram? As you can guess I am not familiar with this stuff... I used to run the following script on this LM before telegram changed their policy (and I could not upgrade the firmware): Code: require 'ssl.https' RE: Executing command on remote server fails - admin - 20.01.2025 You have a separate device that runs your Lua script. You can create a TCP server that forwards messages. Server code (change token and chat_id as needed): Code: require('socket') Client code (change ip and message as needed): Code: require('socket') RE: Executing command on remote server fails - baggins - 20.01.2025 (20.01.2025, 12:54)admin Wrote: You have a separate device that runs your Lua script. You can create a TCP server that forwards messages. Thanks, I will give this a try. I still wonder why my existing script now fails while it has been working previously. Would a reboot help? |