What is an easy way for web-ify of my command line daemon?

Suppose I have a simple script daemon type that I run on my web server. I run it in a terminal with a gnu screen, so I can follow it. This works great (by the way, I'm using this trick ).

But now suppose I would like to create a webpage where I can follow the output of the script. What is the easiest way to do this?

Notes:

  • This is mainly for me and a few co-hackers, so if websockets is the answer and it only works on Chrome or something that is acceptable.
  • This question asks something similar: How to restart all connected browsers triggered by a server event . But I hope for a simpler, quicker and messier solution, and a particularly general way to quickly do this for any script, I could follow the eyebrow.
0
source share
2 answers

Allows your daemon log to be displayed in a place accessible from a script web page (such as a database table) that can display it. Refresh your web page every few seconds. (You can get an idea of ​​this with XmlHttpRequest and Javascript if you want)

Edit:

The easiest way to refresh the page is with meta http-equiv="refresh" content="5"> . A little more elegant is the use of Javascript. You can use something like PeriodicalUpdater for jQuery .

These solutions are survey methods. There is a trick that you can pull out to make the event multiply instantly, called comets. But this is a little more complicated, and frankly, the survey is probably suitable for your use case.

+1
source

This looks really promising (thanks to my friend and extraordinary hacker, David Yang ):

http://blog.new-bamboo.co.uk/2009/12/7/real-time-online-activity-monitor-example-with-node-js-and-websocket

0
source

Source: https://habr.com/ru/post/1308296/


All Articles