4

I need to monitor a Linux server using bash script so scenario is like this

  1. I have a bash script which can monitor a Linux service and it shows result right
  2. Now I need to show the result of bash script to port 8080 or any port like http://192.168.2.1:8080 and it will show status code 200 or error, So when I hit http://192.168.2.1:8080 it will execute the bash script and get result and show it

Note: No web service is running right now on server

3
  • 1
    You will need a minimal http server implementation. You can use netcat, for example. Commented Feb 5, 2015 at 13:16
  • Ok what I did is "python -m SimpleHTTPServer 8000 &" in my directory put my output in .html file Commented Feb 6, 2015 at 10:25
  • I like your approach :) Why don't you use pipes to implement interaction between your bash script and the python server? Commented Feb 6, 2015 at 12:43

1 Answer 1

2

I would recommend using CGI. There go some links:

Regards,

Sign up to request clarification or add additional context in comments.

1 Comment

I think apache is a bit of overkill in this situation. He does not need to manage virtual hosts, create directory aliases, or any of the services apache provides, except parsing the request type and the URI (not even the headers I guess), which can easily be achieved even in a shell script. I know it's charming to do it the way above, but it's superfluous to use such a powerful tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.