Query
I run Ubuntu 9.10 and execute personalized scripts via SSH. I aim to create a website that triggers these scripts without constant polling for input. What approach would you suggest?
I run Ubuntu 9.10 and execute personalized scripts via SSH. I aim to create a website that triggers these scripts without constant polling for input. What approach would you suggest?
hey liam, i think using websockets or maybe a simple message queue could help trigger ur scripts without heavy polling. ever thought about using socket.io for real-time updates? would love to hear more about your setup!
In a similar scenario, I developed an integration where the website back-end was built using a RESTful API that securely triggered scripts via SSH. I used a server-side implementation with languages like Python and modules such as Paramiko to handle the SSH connections reliably. This approach allows for a secure, on-demand execution of backend scripts while minimizing overhead. Additionally, by wrapping the SSH functionalities into controlled endpoints, I ensured that only specific commands could be run, thereby maintaining overall system security.
hey liam, try setting up a backend api to handle requests that then securely kicks off your ssh scripts async. a lightweight server side worker can help and mediate command execution to keep it safe. hope this helps!
hey liam, have u thought about a event-driven setup that uses a small message broker to trigger your scripts? it might cut down on overhead and polling. what kind of events would be ideal for u?
A viable approach is to employ a file-based trigger system that leverages inotify or a similar filesystem event monitoring tool. The website frontend can write a specific command or parameter to a designated file, and a lightweight daemon running on the server watches for changes in that file. Once an update is detected, the daemon can securely initiate the required SSH-run script. In previous projects, this method minimized unnecessary network activity and avoided constant polling. This technique not only simplifies the integration between the website and the server but also maintains efficiency and a controlled, secure execution environment.