1 |
On Wed, Jul 31, 2013 at 07:40:36AM -0400, Tanstaafl wrote |
2 |
> On 2013-07-30 8:30 PM, Walter Dnes <waltdnes@××××××××.org> wrote: |
3 |
> > |
4 |
> > Why do you need vmware tools? From the host, execute... |
5 |
> > |
6 |
> > ssh root@<guest> /sbin/poweroff |
7 |
> |
8 |
> Two reasons this isn't sufficient... |
9 |
> |
10 |
> 1. Extended power outage |
11 |
> |
12 |
> If my UPS sends a shutdown command to the host, I (obviously) want it to |
13 |
> safely shutdown ALL running VMs. |
14 |
> |
15 |
> 2. Manual host shutdown |
16 |
> |
17 |
> I have my hosts configured so that if I press/release the power button, |
18 |
> the host goes through a full power down process. I (obviously) want this |
19 |
> process to also initiate safe shutdowns on all running VM's. |
20 |
> |
21 |
> I do not want to have to SSH in and manually run a command to |
22 |
> uncooperative VM's first, I want to just be able to press/release the |
23 |
> power button, and have the host safely shut down all running VMs, then |
24 |
> itself. |
25 |
|
26 |
***IT DOES NOT HAVE TO BE MANUAL*** I have a 1-line script that shuts |
27 |
down my hot-backup machine, which I bring up once a month for updates. |
28 |
Here it is... |
29 |
|
30 |
#!/bin/bash |
31 |
ssh waltdnes@d531 sudo /sbin/poweroff |
32 |
|
33 |
...with an appropriate entry in /etc/sudoers.d. In your case, you can |
34 |
have your script run like so (assuming the VM's port 22 is redirected to |
35 |
60022) |
36 |
|
37 |
#!/bin/bash |
38 |
ssh -P 60022 root@localhost /sbin/poweroff |
39 |
|
40 |
I repeat, this is scriptable, and does not have to be manual. |
41 |
|
42 |
-- |
43 |
Walter Dnes <waltdnes@××××××××.org> |
44 |
I don't run "desktop environments"; I run useful applications |