이 섹션의 스크립트를 복사하여 input.properties
및 skip_update.sh
를 생성합니다.
input.properties
를 생성합니다.
javahome=JAVA_HOME epmautomatescript=EPM_AUTOMATE_LOCATION username=exampleAdmin password=examplePassword.epw url=exampleURL updatemonths=02,05,08,11
input.properties
를 업데이트합니다.
Table 3-12 input.properties 매개변수
매개변수 | 설명 |
---|---|
javahome |
JAVA_HOME 위치입니다. |
epmautomatescript |
EPM Automate 실행 파일의 절대 경로(epmautomate.sh )입니다. |
username |
서비스 관리자.의 사용자 이름 |
password |
서비스 관리자의 비밀번호 또는 암호화된 비밀번호 파일의 이름 및 위치입니다. |
url |
월별 이외의 업데이트 주기를 설정할 환경의 URL입니다. |
updatemonths |
Oracle Enterprise Performance Management Cloud 업데이트가 url 매개변수로 확인된 환경에 적용되어야 하는 월에 대한 쉼표로 구분된 목록입니다. updatemonths=02,05,08,11 을 예로 들 수 있습니다.
월은 두 자리 숫자로 지정해야 합니다. 1월에서 9월 앞에는 0이 포함됩니다. 스크립트는 |
skip_updates.sh
를 생성합니다.
#!/bin/sh . ./input.properties export JAVA_HOME=${javahome} declare -a monthsarr=(01 02 03 04 05 06 07 08 09 10 11 12) declare -a monthsarrfromcurrent declare -a yearsarrfromcurrent updatemonthsarr=( $(echo "${updatemonths}" | sed 's/,/ /g') ) currentyear=$(date +%y) nextyear=$((currentyear+1)) currentmonth=$(date +%m) populateFromCurrentArrays() { for i in ${!monthsarr[@]} do if [[ "${currentmonth}" == "${monthsarr[$i]}" ]] then startposition=$i break fi done for i in ${!monthsarr[@]} do if [[ ${i} -ge ${startposition} ]] then monthsarrfromcurrent=("${monthsarrfromcurrent[@]}" "${monthsarr[$i]}") yearsarrfromcurrent=("${yearsarrfromcurrent[@]}" "${currentyear}") fi done for i in ${!monthsarr[@]} do if [[ ${i} -lt ${startposition} ]] then monthsarrfromcurrent=("${monthsarrfromcurrent[@]}" "${monthsarr[$i]}") yearsarrfromcurrent=("${yearsarrfromcurrent[@]}" "${nextyear}") fi done } skipUpdateAdd() { local yearnumber="$1" local monthnumber="$2" echo "Running: ${epmautomatescript} skipUpdate add version=${yearnumber}.${monthnumber} comment=\"adding skipUpdate\"" ${epmautomatescript} skipUpdate add version=${yearnumber}.${monthnumber} comment="adding skipUpdate" } processSkipUpdates() { local addcount=0 echo "Running: ${epmautomatescript} login ${username} ${password} ${url}" ${epmautomatescript} login ${username} ${password} ${url} echo "Running: ${epmautomatescript} skipUpdate remove" ${epmautomatescript} skipUpdate remove for i in ${!monthsarrfromcurrent[@]} do local match=1 if [[ ${addcount} -eq 2 ]] then echo "Two skip update add calls have been made. No more will be attempted." break fi for j in ${!updatemonthsarr[@]} do if [[ "${monthsarrfromcurrent[$i]}" == "${updatemonthsarr[$j]}" ]] then match=0 break fi done if [[ ${match} -eq 1 ]] then skipUpdateAdd ${yearsarrfromcurrent[$i]} "${monthsarrfromcurrent[$i]}" addcount=$((addcount+1)) fi done echo "Running: ${epmautomatescript} skipUpdate list" ${epmautomatescript} skipUpdate list echo "Running: ${epmautomatescript} logout" ${epmautomatescript} logout } compareUpdateMonths() { local thismonth=$1 local nextmonth=$2 local nextmonthorig=${nextmonth} if [[ ${nextmonth} -lt ${thismonth} ]] then nextmonth=$((nextmonth+12)) fi monthdiff=$((nextmonth-thismonth)) if [[ ${monthdiff} -gt 3 ]] then echo "There are more than 2 months skipped from month ${thismonth} to month ${nextmonthorig}. Please correct updatemonths in input.properties so that there are not more than two months skipped between each update month. Exiting." exit 1 fi } validateUpdateMonths() { for i in ${!updatemonthsarr[@]} do nextint=$((i+1)) thisupdatemonth="${updatemonthsarr[$i]}" thisupdatemonthint=${thisupdatemonth#0} nextupdatemonth="${updatemonthsarr[$nextint]}" nextupdatemonthint=${nextupdatemonth#0} if [[ ${nextupdatemonth} == "" ]] then nextupdatemonth="${updatemonthsarr[0]}" nextupdatemonthint=${nextupdatemonth#0} fi compareUpdateMonths ${thisupdatemonthint} ${nextupdatemonthint} done } validateUpdateMonths populateFromCurrentArrays processSkipUpdates