VMware Cloud Community
jeffj2000
Enthusiast
Enthusiast
Jump to solution

run shell script in ESXi

Hi. I have lots of esxcli commands that we are using to move hosts to new arrays. So unmounting datastores, detaching the scsi naa, removing the dead path, etc.

Can I just add these to a shell script ie, #!\bin\bash and just dump all these esxcli commands in there? And where would I save it? The scratch partition? I cant do all the esxcli commands we have wiht powercli. So I rather than shove them in shell script and copy it to all our hosts. Thanks,,,

0 Kudos
1 Solution

Accepted Solutions
depping
Leadership
Leadership
Jump to solution

ESXi run busybox so you would need to use:

#!/bin/sh

You could dump the script anywhere, maybe a shared datastore which remains available for all hosts?

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

View solution in original post

0 Kudos
4 Replies
depping
Leadership
Leadership
Jump to solution

ESXi run busybox so you would need to use:

#!/bin/sh

You could dump the script anywhere, maybe a shared datastore which remains available for all hosts?

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

0 Kudos
Chris_CCT
Contributor
Contributor
Jump to solution

You can add the commands to /etc/rc.local.d/local.sh

This file is executed at the end of the boot process and is persistent between reboots.

0 Kudos
continuum
Immortal
Immortal
Jump to solution

> You can add the commands to /etc/rc.local.d/local.sh

That makes no sense as he probably does not want to re-run those commands after every reboot.

Also it is way easier to just store the command on a normal datastore and launch it via a putty session.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
jeffj2000
Enthusiast
Enthusiast
Jump to solution

Hi. Thank you everyone! Thanks,,,

0 Kudos