環境からの不要なファイルの削除

これらのスクリプトを使用して、環境から不要なファイルを削除します。

これらのスクリプトでは、次のステップが実行されます:

  • 環境にサインインします。
  • 環境のファイルとスナップショットをリストします。
  • 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自動化の実行可能ファイル(epmautomate.sh)の絶対パス。Linux/UNIXの場合のみ。
username アイデンティティ・ドメイン管理者の役割も保持するサービス管理者のユーザー名。
password サービス管理者のパスワードまたは暗号化されたパスワード・ファイルの名前と場所。
serviceURL スナップショットを生成する環境のURL。
file1およびfile2 環境から削除するファイルまたはスナップショットの名前。ファイルが送信ボックスにない場合は、ファイルのパスおよび名前を指定します。
   

スクリプトの実行

  1. 前述の項のスクリプトをコピーして、removeUnnecessaryFiles.ps1またはremoveUnnecessaryFiles.shを作成します。
  2. input.propertiesファイルを作成して、removeUnnecessaryFilesスクリプトが配置されているディレクトリに保存します。このファイルのコンテンツは、オペレーティング・システムによって異なります。input.propertiesファイルの作成を参照してください。

    このディレクトリの書込み権限があることを確認してください。Windowsの場合、スクリプトを実行できるよう、「管理者として実行」オプションを使用してPowerShellを開始する必要があります。

  3. スクリプトを起動します。
    • Windows PowerShell: removeUnnecessaryFiles.ps1を実行します。
    • Linux/UNIX: ./removeUnnecessaryFiles.shを実行します。