환경에서 불필요한 파일 제거

이러한 스크립트를 사용하여 환경에서 불필요한 파일을 제거합니다.

이러한 스크립트는 다음 단계를 수행합니다.

  • 환경에 로그인합니다.
  • 환경의 파일 및 스냅샷을 나열합니다.
  • input.properties에 지정된 파일을 삭제합니다.
  • 로그아웃합니다.

Windows 샘플 스크립트

다음 스크립트를 복사하여 removeUnnecessaryFiles.ps1이라는 파일을 생성합니다. 로컬 디렉토리에 파일을 저장합니다.

$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$file1="$($inputproperties.file1)"
$file2="$($inputproperties.file2)"

epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate listfiles
epmautomate deletefile ${file1}
epmautomate deletefile ${file2}
epmautomate logout

Linux/UNIX 샘플 스크립트

다음 스크립트를 복사하여 removeUnnecessaryFiles.sh라는 파일을 생성합니다. 로컬 디렉토리에 파일을 저장합니다.

#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} listfiles
${epmautomatescript} deletefile "${file1}"
${epmautomatescript} deletefile "${file2}"
${epmautomatescript} logout

input.properties 파일 생성

removeUnnecessaryFiles 스크립트를 실행하려면 input.properties 파일을 생성하고 해당 환경에 대한 정보로 업데이트합니다. removeUnnecessaryFiles.ps1 또는 removeUnnecessaryFiles.sh가 저장된 디렉토리에 파일을 저장합니다.

Windows

username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
file1=FILE_NAME
file2=FILE_NAME

Linux/UNIX

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
file1=FILE_NAME
file2=FILE_NAME

표 3-7 input.properties 매개변수

매개변수 설명
javahome JAVA_HOME 위치입니다. Linux/UNIX에만 해당합니다.
epmautomatescript EPM Automate 실행 파일의 절대 경로(epmautomate.sh)입니다. Linux/UNIX에만 해당합니다.
username ID 도메인 관리자 역할도 가진 서비스 관리자의 사용자 이름입니다.
password 서비스 관리자의 비밀번호 또는 암호화된 비밀번호 파일의 이름 및 위치입니다.
serviceURL 스냅샷을 생성하려는 소스 환경의 URL입니다.
file1file2 환경에서 삭제할 파일 또는 스냅샷의 이름입니다. 파일이 아웃박스에 없으면 파일의 경로 및 이름을 지정합니다.
   

스크립트 실행

  1. 이전 섹션에서 스크립트를 복사하여 removeUnnecessaryFiles.ps1 또는 removeUnnecessaryFiles.sh를 생성합니다.
  2. input.properties 파일을 생성하고 removeUnnecessaryFiles 스크립트가 있는 디렉토리에 저장합니다. 이 파일의 콘텐츠는 운영 체제에 따라 다릅니다. input.properties 파일 생성를 참조하십시오.

    이 디렉토리에서 쓰기 권한이 있어야 합니다. Windows의 경우 관리자 권한으로 실행 옵션으로 PowerShell을 시작해야 스크립트를 실행할 수 있습니다.

  3. 스크립트를 실행합니다.
    • Windows PowerShell: removeUnnecessaryFiles.ps1을 실행합니다.
    • Linux/UNIX: ./removeUnnecessaryFiles.sh를 실행합니다.