crontab

crontab 定时环境
crontab -l 查看
crontab -e 编辑
10 7,8,9 * * * sh /app/dcol/markit/markit/markit.sh
shell 脚本跑python 脚本
#!/bin/bash
source ~/.bash_profile
data_date=`date+%Y%m%d%H%M%S`
sub_dir=$(cd `dirname $0`;pwd)
cd $sub_dir
python main.py 2>&1 | tee /app/dcol/markit/log/markit_$data_date.log/markit_$data_date.log
if grep -q "records"  /app/dcol/markit/log/markit_$data_date.log/markit_$data_date.log
then
 exit 2
else
 exit 1
fi
posted @ 2020-10-22 16:21  rjm123456  阅读(57)  评论(0编辑  收藏  举报