定时执行shell脚本拉取数据
2020-07-31 10:57
2126 查看
#! /bin/bash #获取前一天时间 date=`date -d yesterday +%Y%m%d` #当前时间 nowdate=`date +%Y%m%d%H%M` #每天几点的时间 time=`date "+%H%M"` while true do fileName="./file.$date" if [ ! -f $fileName ] && [ $time -gt 1000 ];then python3 /home/work/pv/sendEmail.py #此处为超过时间未拉取到文件自动发送邮件提醒 break elif [ ! -f $fileName ] && [ $time -lt 1000 ];then wget hostname/url/filename #拉取文件得路径 else echo "文件已存在".`date -d yesterday +%Y%m%d` >> ./pv.log break fi done
定时任务:
- 7 * * * cd /home/work/pv && sh pv.sh > /dev/null 2>&1
相关文章推荐
- Linux 执行定时任务 shell脚本
- 安卓自动化测试:定时执行 shell 脚本,测试完成后自动重启
- 详细的Linux Ubuntu定时执行Php脚本及Shell脚本笔记
- Linux crontab定时执行Shell脚本时的一个小坑:一种类似场景 (当需要执行特定的命令时) 解决思路
- linux 定时执行shell脚本详解
- Linux利用crontab定时执行shell脚本
- Linux 定时执行shell脚本命令之crontab
- 【sqoop】定时执行shell脚本,sqoop从mysql导出多张表信息到hbase
- Linux crontab定时执行Shell脚本需要执行特定的命令时解决思路
- LINUX定时执行SHELL脚本实现DB2数据库操作,crontab无法正常识别执行
- Linux--Linux系统中创建定时任务执行shell脚本
- Linux中使用crontab命令定时执行shell脚本或其他Linux命令
- 使用crontab,让linux定时执行shell脚本
- shell脚本直接执行没有问题,crontab定时执行失败的解决方法
- Linux 定时执行shell脚本_crontab
- 如何编写Linux定时执行shell脚本任务
- shell 定时获取5分钟内的日志数据-------通用脚本(框架)
- shell脚本放到crontab里定时执行
- crontab 定时执行shell脚本
- Linux中编辑定时执行shell脚本,清除tomcat日志