I know there is an older thread on this, but it didn't really provide a solution.
Restart Management Agents with SSHCommand failed...https://communities.vmware.com/thread/436262
Looking for some guidance on creating a workflow to restart esxi host management agents.
I have successfully configured the SSH plugin, and authorized keys on the host. I'm able to use the Run SSH command workflow to pass commands to the host.
However, passing "/sbin/services.sh restart" to the workflow just hangs as indicated in the above referenced thread.
Has anyone successfully created a workflow to restart host managements?
Any help is greatly appreciated!
I found that if you let the workflow run it can take upwards of an hour to complete. I'll keep digging into it to see if I can find out why, but I did find a workaround. If you send stdout and stderr to null the workflow completes as expected. /sbin/services.sh restart &>/dev/null
I had simiar issue with powercli and plink
Try to execute this:
VAR=`$(pidof -s sshd) && /sbin/services.sh restart && kill `$VAR
This isn't helping the issue. I appreciate the reply!
So are you saying that your management agents are NOT restarting???? I expect that, based on that behaviour, that they are. Keep in mind that the ssh hang is expected as you are cutting your own legs off. That is, you are restarting the very thing you are talking with. So as the other example showed, you will need to kill off your ssh after a while as the restart kills the other end.
Carl L.
The services restart but the workflow hangs. There are several services stopped and then started, and some include errors, so I'm wondering if this is what is causing it to hang. But once the restart completes its returning the correct return code, so I'm not sure.
I thought that as well, but SSH isn't part of the services.sh restart script. If you run /sbin/chkconfig -io you can see SSH isn't listed in the services, and if you run /sbin/chkconfig --list SSH is listed as off.
I found that if you let the workflow run it can take upwards of an hour to complete. I'll keep digging into it to see if I can find out why, but I did find a workaround. If you send stdout and stderr to null the workflow completes as expected. /sbin/services.sh restart &>/dev/null