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