import datetime
from datetime import timedelta
now = datetime.datetime.now()
now_data = now.strftime('%Y-%m-%d') + " 00:00:00"# 获取当前时间
yes_date = (now + timedelta(days=-1)).strftime('%Y-%m-%d') + " 00:00:00"
tmo_date = (now + timedelta(days=1)).strftime('%Y-%m-%d') + " 00:00:00"
str_now = now.strftime('%Y%m%d')
print(type(now_data), yes_date)
# crontab -e
cd /root;sh index.sh
#!/bin/sh
#分(0-59) 小时(0-23) 日(1-31) 月(1-12) 星期(0-6) 命令
30 7 8 * * * ls:指定每月8号的7:30执行ls命令
58 17 * * * /root/bin/python index.py