To execute a command during the VMware vSphere ESXi boot process, either the
rc.local or
local.sh configuration file can be modified.
Note: Broadcom recommends you to not modify these files. Ensure to modify these files only under special use case scenarios or if directed by Broadcom Technical Support. Most ESX/ESXi configuration options and driver parameters persist across reboots and are set using other methods. For more information, see
Configuring advanced options for ESX/ESXi (1038578) and
Configuring advanced driver module parameters in ESX/ESXi (1017588).
ESXi 6.x / 7.x / 8.x
To execute a command during the ESXi boot process, modify the local.sh file located at the /etc/rc.local.d/ directory.
To modify the local.sh file:
- Open the local.sh file using the vi editor.
- Add the command to be executed above the line exit 0. For example:
#!/bin/sh
#!/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
In the above example, the user is setting vmnic5 to autonegotiate Flow Control.
Notes:
- Commands added after the exit 0 line are not executed.
- You can add additional commands before exit 0.
- The commands are executed in the order listed.
- Usually, it is not necessary to modify the permissions of the local.sh file. In ESXi 5.1+, by default, the root user has read and write permissions on this file.
- The script will not be run when UEFI secure boot is enabled.