python 统计当前修改html文件中的https
来源:互联网 发布:linux 执行lua脚本 编辑:程序博客网 时间:2024/05/22 10:42
需求:统计当前修改的html文件中的https 的url,通过rsysnc 推送到email服务器,转发到指定邮箱
1.python版
#! /usr/bin/env python
# -*- coding:utf-8 -*-# Author :zyb
import os
import re
import time
file=os.popen('find /home/wwwroot/html -type f -mtime -1|grep "html$"')
with open('url-%s.txt'%(time.strftime('%Y-%m-%d')),'w') as f2:
for html in file:
html=html.strip()
with open(html,'r') as f:
f2.write("=============================================================\t\n")
f2.write("file:%s"%html.encode('utf-8')+'\t\n')
f2.write("-------------------------------------------------------------\t\n")
for line in f:
https=re.findall('(https://.*\.js|https://.*\=\d+|https://.*\.html)',line)
if https:
for i in https:
f2.write(i+"\t\n")
f2.write("=============================================================\t\n")
os.system('rsync -avz ./url-$(date +%F).txt rsync_backup@x.x.x.x::data --password-file=/etc/rsync.password')
os.system('rm -rf ./url-$(date +%F).txt')
2 通过定时任务crontab 定时推送
#update today http file
50 17 * * * /usr/bin/python /server/script/update-url.py >/dev/null 2>&1
3 邮件服务器定时发邮件
脚本:
[root@n-144 data]# cat sendmail.sh
#! /bin/bash
echo "today update http files"|mail -s "$(date +%F) http file" -a /data/url-$(date +%F).txt xxxxx@qq.com xxxxx@qq.com
[root@n-144 data]# crontab -l
#today update html files
55 17 * * * /bin/sh /data/sendmail.sh >/dev/null 2>&1
结束
阅读全文
0 0
- python 统计当前修改html文件中的https
- python 小练:统计打印出当前目录中的文件
- Python统计txt文件中的英文单词个数
- 【python】统计文件中的字符串数目
- Python 统计一个纯英文文件中的单词总个数
- Python 中的词频统计
- Python修改当前工作目录
- 利用Python编写一个程序 统计当前目录下的每个文件类型的文件数目
- 代码修改统计工具(python)
- Python 统计文件行数
- python 统计文件行数
- 修改HTML中的cursor
- 修改HTML中的cursor
- 统计文件中的单词
- 统计目录中的文件
- linux统计当前文件个数命令
- Linux 统计当前文件夹、文件的数目
- Linux 统计当前文件/目录个数
- Itellij IDEA安装
- Android studio 中搜狗输入法 中文提示不跟随光标
- MYSQL数据库导入sql的时候报错:[Err] 1046
- 算法课后题8.8
- 卢俊卿与波兰前总统克瓦希涅夫斯基在大连亲切会谈
- python 统计当前修改html文件中的https
- DuerOS的DCS SDK编译问题
- 【免费,每日稳定更新】 得到app 喜马拉雅 免费分享了
- TensorFlow代码实现(一)[MNIST手写数字识别]
- 伪类选择符
- POJ 3041 Asteroids(最小点覆盖)
- 实战Java高并发程序设计-06 Java并发包并发集合
- [论文学习]Private traits and attributes are predictable from digital records of human behavior
- 获取XHR 兼容所有