wf

change_run_date.sh

[root@localhost info]# cat change_run_date.sh
#!/bin/bash
input_file=$1
insert_date=$2


if [ ! -f $input_file ]
then
echo "the $input_file  does not exist"
exit 4
fi

input_file_name=${input_file##*/}

if [ "$input_file_name" = "parameter.par" ]
then
echo "you can not change the old parameter.par file"
exit 4
fi

if [ ! -n "$(echo $insert_date | sed -n "/^[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/p")" ]
then
echo "the $insert_date format should be YYYYMMDD"
echo "the $insert_date is not a date"
exit 4
fi

echo $input_file
echo $insert_date
sed -i "s/RunDate=.*/RunDate=$insert_date/g" $input_file
result=$?

if [ $result != 0 ]
then
echo "failure replace the RunDate"
exit 4
fi


 

run_job_manually.sh

#!/bin/bash

if [ $# -ne 6 ]
then
echo "parameter number $#"
echo "Usage:$0,domain_name,is_name,WorkflowName,input_file,start_date,end_date"
exit 4
fi

DOMAIN_NAME=$1
IS_NAME=$2
WorkflowName=$3
input_file=$4

if [ ! -f $input_file ]
then
echo "the $input_file does not exist"
exit 4
fi

input_file_name=${input_file##*/}

if [ "$input_file_name" = "parameter.par" ]
then
echo "you can not change the old parameter.par file"
exit 4
fi

if [ ! -n "$(echo $5 | sed -n "/^[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/p")" ]
then
echo "the $5 format should be YYYYMMDD"
echo "the $5 is not a date"
exit 4
fi
if [ ! -n "$(echo $6 | sed -n "/^[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/p")" ]
then
echo "the $6 format should be YYYYMMDD"
echo "the $6 is not a date"
exit 4
fi

start_date=`date -d "+0 day $5" +%Y%m%d`
end_date=`date -d "+0 day $6" +%Y%m%d`

tmp_date=`date -d "+29 day $start_date" +%Y%m%d`
if [[ $tmp_date -lt $end_date ]]
then
echo "the end date should not be greater than $tmp_date"
echo "you can not load more then 30 days data"
exit 4
fi


while [[ $start_date -le $end_date ]]
do

sh ./change_run_date.sh $input_file $start_date 2>&1
result=$?
echo $result

echo "Start Workflow ${WorkflowName} on $start_date"
$INFA_HOME/server/bin/pmcmd startworkflow -d $DOMAIN_NAME -sv $IS_NAME -uv INFA_USER -pv INFA_PASSWORD -paramfile input_file.par -f STAGING_ARCHIVE -wait $WorkflowName
RunningStatus=$?

if [[ "$RunningStatus" -eq 0 ]]
then
echo "The task ${WorkflowName} has been completed successfully on $start_date"
else
echo "The task ${WorkflowName} has exited with error code ${RunningStatus};"
fi

echo "**********${WorkflowName}********** : End at $(date)"

date=$start_date
start_date=`date -d "+1 day $date" +%Y%m%d`

done
 

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值