VMware vSphere ESXi で rc.local または sh.local ファイルを変更して、起動中にコマンドを実行する
search cancel

VMware vSphere ESXi で rc.local または sh.local ファイルを変更して、起動中にコマンドを実行する

book

Article ID: 319883

calendar_today

Updated On: 02-26-2025

Products

VMware vSphere ESXi

Issue/Introduction

この記事には、rc.local または local.sh ファイルを変更して起動プロセス中に VMware vSphere ESXi でコマンドを実行する方法が記載されています。このプロセスは、使用している VMware vSphere ESXi のバージョンによって異なります。

注: UEFI セキュア ブートが有効になっている場合、これらのオプションは使用できません。

Symptoms:
免責事項:これは英文の記事「Modifying the rc.local or local.sh file in VMware vSphere ESXi to execute commands while booting(324525)」の日本語訳です。記事はベストエフォートで翻訳を進めているため、ローカライズ化コンテンツは最新情報ではない可能性があります。最新情報は英語版の記事で参照してください。


Environment

VMware vSphere ESXi 8.0
VMware vSphere ESXi 7.0
VMware vSphere ESXi 6.7
VMware vSphere ESXi 6.5

Resolution

VMware vSphere ESXi の起動処理中にコマンドを実行するには、rc.local または local.sh 構成ファイルを変更します。

:Broadcom では、これらのファイルを変更しないことをお勧めしています。これらのファイルは、特殊な使用状況シナリオ下か、Broadcom テクニカル サポートによる指示があった場合にのみ変更するようにしてください。ほとんどの VMware vSphere ESXi 構成オプションおよびドライバ パラメータは再起動しても維持され、他の方法を使用して設定します。詳細については、Configuring advanced options for ESXi(
310338) および Configuring advanced driver module parameters in ESX/ESXi (310348) を参照してください。

ESXi 6.x/7.x/8.x

ESXi  の起動処理中にコマンドを実行するには、/etc/rc.local.d/ ディレクトリにある local.sh ファイルを変更します。
 
local.sh ファイルを変更するには:
  1. vi エディタを使用して local.sh ファイルを開きます。
  2. 実行するコマンドを exit 0 行の上に追加します。例:

    #!/bin/sh
    
    # local configuration options
    
    # Note: modify at your own risk!  If you do/use anything in this
    # script that is not part of a stable API (relying on files to be in
    # specific places, specific tools, specific output, etc) there is a
    # possibility you will end up with a broken system after patching or
    # upgrading.  Changes are not supported unless under direction of
    # VMware support.
    
    # Note: This script will not be run when UEFI secure boot is enabled.
    
    esxcli network nic pauseParams set -n vmnic5 -a true
    exit 0
この例では、ユーザがvmnic5に対しフロー制御の自動ネゴシエーションを設定しています。

  • exit 0 行の後に追加されたコマンドは、実行されません。
  • 追加のコマンドは、exit 0 の前に追加できます。
  • コマンドはリストされた順で実行されます。
  • 通常、local.sh ファイルの権限を変更する必要はありません。ESXi 5.1以降 では、デフォルトで、root ユーザーがこのファイルに対する読み取りおよび書き込みの権限を持っています。
  • UEFI セキュアブートが有効である場合は、スクリプトは実行されません。




Additional Information