Python判断端口连通性
#!/usr/bin/env python
# -*- coding: utf-8 -*- import socket,sys def MySQL_Connet(MySQL_ip):
MySQL_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = MySQL_sock.connect_ex((MySQL_ip,56000))
if result == 0:
print ('DateBase Port is Open')
else:
print ("DateBase Port is Not open")
sys.exit(120) def Redis_Con(Redis_ip):
Redis_sk=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
Redis_Result=Redis_sk.connect_ex((Redis_ip,6379))
if Redis_Result == 0:
print('Redis Port is Open')
else:
print('Redis Port is Not Open')
sys.exit(121) if __name__ == '__main__':
MySQL_Connet('127.0.0.1')
Redis_Con('127.0.0.1')
Python判断端口连通性的更多相关文章
- 使用Python扫描端口情况
#!/usr/bin/python# -*- coding:utf8 -*-# Python: 2.7.8# Platform: Windows# Authro: ...
- python扫描端口脚本
# -*- coding:utf8 -*- # # Python: 2.7.8 # Platform: Windows # Authro: wucl # Program: 端口扫描 # History ...
- python监控端口脚本[jkport1.0.py]
此脚本根据端口判断进程是否存活, 如果有指定的端口就证明进程是没问题的, 如果检测不到端口就是说业务进程已经挂掉了, 此时自动重启程序, 不多说下面请看脚本 创建脚本 我这里模拟的是nginx, 监控 ...
- linux查看端口占用情况,python探测端口使用的小程序
Linux如何查看端口 1.lsof -i:端口号 用于查看某一端口的占用情况,比如查看8000端口使用情况,lsof -i:8000 # lsof -i:8000 COMMAND PID USER ...
- python判断字符串
python判断字符串 s为字符串s.isalnum() 所有字符都是数字或者字母s.isalpha() 所有字符都是字母s.isdigit() 所有字符都是数字s.islower() 所有字符都是小 ...
- 【Python备忘】python判断文件和文件夹是否存在
python判断文件和文件夹是否存在 import os os.path.isfile('test.txt') #如果不存在就返回False os.path.exists(directory) #如果 ...
- js判断网络连通性
js判断网络连通性 if (window.navigator.onLine == true) { console.log("首次 -- 已连接 ...
- python 判断连个 Path 是否是相同的文件夹
python 判断连个 Path 是否是相同的文件夹 import os os.path.normcase(p1) == os.path.normcase(p2) normcase() 在 windo ...
- while true 死循环判断端口按顺序启动应用
需求:spring微服务应用启动较慢并且要求一个应用启完才能启第二个应用. 思路:加了个while true 死循环判断端口启动了才启下一个应用. 执行方式:/appupgrade/spring_cl ...
随机推荐
- CSS的重用
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- spark复习笔记(5):API分析
0.spark是基于hadoop的mr模型,扩展了MR,高效实用MR模型,内存型集群计算,提高了app处理速度. 1.特点:(1)在内存中存储中间结果 (2)支持多种语言:java scala pyt ...
- td内容超出 以…显示
table中的td内容超出以省略号显示,需满足的条件是: <style type="text/css"> table{ table-layout: fixed; bor ...
- ffmpeg的中文文档
1. 概要 ffmpeg [global_options] {[input_file_options] -i INPUT_FILE} ... {[output_file_options] OUTPUT ...
- iOS开发-retain/assign/strong/weak/copy/mutablecopy/autorelease区别
依旧本着尊重原创和劳动者的原则,将地址先贴在前面: http://www.cnblogs.com/nonato/archive/2013/11/28/3447162.html,作者Nonato 以下内 ...
- C# 获得系统环境
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- linux安装 inotify
[root@rsync-client-inotify ~]# yum install make gcc gcc-c++ [root@rsync-client-inotify ~]# wget http ...
- pg_dumpall - 抽出一个 PostgreSQL 数据库集群到脚本文件中
SYNOPSIS pg_dumpall [ option...] DESCRIPTION 描述 pg_dumpall 是一个用于写出("转储")一个数据库集群里的所有 Postgr ...
- Java版基于SpringBoot+Vue.js实现自动创表自动定时采集(各个微信公众号商城产品进行采集)-爬虫篇
- JuniorCTF - Web - blind
题目链接 https://ctftime.org/task/7450 参考链接 https://github.com/Dvd848/CTFs/blob/master/2018_35C3_Junior/ ...