この項のスクリプトをコピーすることにより、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自動化の実行可能ファイル(epmautomate.sh)の絶対パス。 |
username |
サービス管理者のユーザー名 |
password |
サービス管理者のパスワードまたは暗号化されたパスワード・ファイルの名前と場所。 |
url |
月次以外の更新頻度を設定する環境のURL。 |
updatemonths |
Oracle Fusion Cloud Enterprise Performance Managementの更新時のurlパラメータで識別される環境に適用する必要がある月のカンマ区切りリスト。例: updatemonths=02,05,08,11。
月は2桁で指定する必要があります。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