# ServerCheckTimer **Repository Path**: xiaojin21cen/ServerCheckTimer ## Basic Information - **Project Name**: ServerCheckTimer - **Description**: python3 定时任务,去监控网站运行情况。技术:python3 、 apscheduler - **Primary Language**: Python - **License**: MulanPSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2020-11-24 - **Last Updated**: 2023-07-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 1、介绍 利用python定时地去指定的的网址上抓取网页标题,如果已预设的标题一致,则认为服务正常,否则认为服务异常。 如果服务异常,则发送邮件到开发人员的邮箱,提醒服务异常。 ## 2、代码 ### 1)requirements.txt 导入依赖库 ```shell pip install -r requirements.txt ``` requirements.txt 内容: ```python APScheduler==3.6.3 beautifulsoup4==4.9.3 bs4==0.0.1 email==6.0.0a1 pytz==2020.4 six==1.15.0 soupsieve==2.0.1 tzlocal==2.1 ``` ## 3、启动 运行脚本: ```shell python mainTimer22.py ``` 控制台打印: ``` 定时任务启动 定时任务启动 定时任务启动 ``` 说明: 如果出现异常,可能是代码的依赖库引用错误外,还可能是网站做反爬处理,可以换个网站试试。