Ok I go to:
https://mysite.com:10000/status/index.cgi (Webmin, Server Status)
Then I click on "Add Monitor of Type" -> "Apache webserver"
There is an option that sais "If monitor goes down, run command"
I want to creat a bash program
apache_bring_up.sh
in which I will first run a netstat command to see if any other program is listening on port 80 or port 443, so that I can avoid the "(98) Address already in use" error
This is the program and the out put of it
# netstat --numeric-ports -lp | grep :80
tcp 0 0 srv.site.com:80 *:* LISTEN 23508/httpd
Ok, so in this example PID 23508 is listening on port 80, the process name is httpd, but some time it happened that qmail was disturbing in those ports.
My main question is, how can I convert this command:
# netstat --numeric-ports -lp | grep :80
in another one that passes the output (in this case: tcp 0 0 srv.site.com:80 *:* LISTEN 23508/httpd) and gives me only the PID?
I want to kill -9 xxxx that process, and then run start apache again
Thanks in advance