The tail of the log on the server I get off and dynamically display it on the web page

Basically what I want to do is write a script that will allow me to ssh to the server and pick up the log, and then pass the batch handle to that tail and display it dynamically on the web page. I already have an idea how to dynamically refresh my web page using jquery, but can anyone tell me how to remove the tail of the log?

+4
source share
3 answers

You can do ssh host.com tail /var/log/some_file . You will have to do this periodically or use -f and add it somewhere. Finally, you must configure your ssh keys so that you do not enter passwords.

+2
source

You should use jsch if you want full portability.
This example should help you get started. http://www.jcraft.com/jsch/examples/Shell.java

EDIT: you have to configure ssh-keys jsch. I guess this is possible.

+1
source

If you delve into the Jenkins / Hudson code, then they are implemented fairly neatly and with open source code.

0
source

All Articles