ESXi 5.1 / 5.5 / 6.x / 7.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. For more information, see Editing configuration files in VMware ESXi and ESX (1017022).
- 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 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.