Instruções para UNIX/Linux

Crie input.properties e skip_update.sh1 copiando os scripts nesta seção.

  1. Crie input.properties copiando o script a seguir:
    javahome=JAVA_HOME
    epmautomatescript=EPM_AUTOMATE_LOCATION
    username=exampleAdmin
    password=examplePassword.epw
    url=exampleURL
    updatemonths=02,05,08,11
    
  2. Atualize input.properties especificando valores do parâmetro.

    Table 3-12 Parâmetros de input.properties

    Parâmetro Descrição
    javahome Localização de JAVA_HOME.
    epmautomatescript Caminho absoluto do EPM Automate (epmautomate.sh).
    username Nome de usuário de um Administrador de Serviço.
    senha A senha do Administrador de Serviço ou o nome e a localização do arquivo de senha criptografado.
    url O URL do ambiente em que você deseja definir a frequência de atualização não mensal.
    updatemonths Uma lista separada por vírgulas dos meses em que as atualizações do Oracle Enterprise Performance Management Cloud devem ser aplicadas ao ambiente identificado pelo parâmetro url. Por exemplo, updatemonths=02,05,08,11.

    Os meses devem ser especificados como dois dígitos; inclua um zero antes dos meses de janeiro a setembro. Este script tenta executar o comando skipUpdate para os meses não incluídos no valor do parâmetro updatemonths. Por exemplo, se você especificar updatemonths=02,05,08,11, o script tentará definir os sinalizadores de ignorar atualização para janeiro, março, abril, junho, julho, setembro, outubro e dezembro de modo que as atualizações sejam feitas somente em fevereiro, maio, agosto e novembro.

  3. Crie skip_updates.sh copiando o script a seguir:
    #!/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