Get the App
SLTechnology News&Howtos  ›  Development  › 

How does linux implement a shell script that monitors whether the port is working?

Shulou Source: shulou.com Published: 2022-06-03 08:47:49 11月15日 Update

This article will explain in detail how linux implements the shell script to monitor whether the port is normal. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

The code is as follows:

#! / bin/bash port= "80" restart= "/ etc/init.d/httpd restart" EMAIL= "/ bin/echo selboo | mutt-s" restart httpd "root@selboo.com.cn" netstat-ln | awk'/ ^ tcp/ {print $4}'| grep-Q ": $port$" | {# reboot httpd eval $restart $EMAIL exit $?} exit 0 article on "how to implement a shell script to monitor whether the port is working" ends here. I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Articles ports scripts monitoring more good practical code content articles knowledge references help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Tech Info macOS Shulou Technology Redmi