public_time.cfg时间公共变量设置

###################################
# code review heguoxiu@berchina.com 20170504
# System Name : 大数据智慧分析平台
# Author : heguoxiu
# Description : 公共变量配置差数
##################################

###公共赋值变量###
#获取当前日期
current_dt=`date -d "-0 day" +%Y-%m-%d`

#把sh脚本绝对路径赋值给变量
parse_path="/parse/opt/shell/job"

#把sh脚本绝对路径赋值给变量
export_path="/parse/opt/shell/export"

#日志log绝对路径赋值给变量
log_path="/parse/log/shell"

###调度时间###
#year=`date -d "-1 day $current_dt" +%Y`
#month=`date -d "-1 day $current_dt" +%Y%m`
#day=`date -d "-1 day $current_dt" +%Y%m%d`

#v_fm_tm=`date -d "-1 day $current_dt" +%Y-%m-%d`
#v_to_tm=`date -d "+0 day $current_dt" +%Y-%m-%d`

###补数据时间###
year=`date -d "-1 day 2017-12-31" +%Y`
month=`date -d "-1 day 2017-12-31" +%Y%m`
day=`date -d "-1 day 2017-12-31" +%Y%m%d`
v_fm_tm=`date -d "-1 day 2016-01-01" +%Y-%m-%d`
v_to_tm=`date -d "+0 day 2017-12-31" +%Y-%m-%d`

cur_month_start=`date -d "+0 day 2018-01-01" +%Y-%m-01`
last_month_start=`date -d "+0 day 2016-01-01" +%Y-%m-01`

#获得上月初、本月初日期
#cur_month_start=`date -d "$current_dt" +%Y-%m-01`
#last_month_start=`date -d "-1 month $cur_month_start" +%Y-%m-%d`

################ zy Current Month ###############
v_fm_cm=`date +%Y-%m-01 00:00:00`
v_to_cm=`date -d "-1 second $(date -d "1 month $current_dt" +%Y-%m-01 %H:%M:%S)" +%Y-%m-%d %H:%M:%S`

################ zy Last Month ###############
v_fm_lm=`date -d "-1 month $current_dt" +%Y-%m-01 %H:%M:%S`
v_to_lm=`date -d "-1 second $(date +%Y-%m-01 00:00:00)" +%Y-%m-%d %H:%M:%S`

原文地址:https://www.cnblogs.com/heguoxiu/p/10120562.html