複製本節中的指令碼來建立 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-13 input.properties 參數
參數 | 描述 |
---|---|
javahome |
JAVA_HOME 位置。 |
epmautomatescript |
EPM Automate 執行檔 (epmautomate.sh ) 的絕對路徑。 |
username |
服務管理員。的使用者名稱 |
password |
服務管理員的密碼,或加密密碼檔案所在的名稱和位置。 |
url |
要設定非每月更新節奏之環境的 URL。 |
updatemonths |
當 Oracle Fusion Cloud Enterprise Performance Management 更新必須套用至 url 參數所識別的環境時使用的月份逗號分隔清單。例如,updatemonths=02,05,08,11 。
月份必須指定為兩位數;包括 1 月到 9 月前面的零。這個指令碼嘗試針對 |
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