#!/bin/bash
#ex) /start_batch.sh {jobname} --param1=1 --param2=2
pwd_path='/deploy/'
jar_nm='batch.jar'
file_nm=$pwd_path$jar_nm
cp_file_nm=$file_nm."$(date +'%y%m%d%H%M%S')"

function delete_filter() {
before_jar_filter=$jar_nm.$1*
for f in $before_jar_filter; do
rm -f $pwd_path$f
done
}

delete_filter "$(date -v-2d +'%y%m%d')" #2day ago
delete_filter "$(date -v-2m +'%y%m')" #2month ago

job_name=$1
cp_cmd='cp '$file_nm' '$cp_file_nm
$cp_cmd
jar_cmd='java -jar -Dspring.profiles.active=prd '$cp_file_nm' --spring.batch.job.names='$job_name

for arg in $*; do
if [[ $arg == *"--"* ]]; then
jar_cmd=${jar_cmd}' '$arg
fi
done
echo $jar_cmd


1. 백업

2. 오래된 백업삭제 jar

3. 실행

+ Recent posts