10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VMware Fusionの仮想マシンを自動起動させ、安全にシャットダウンさせるためのメモ

Posted at

VMware Fusionで作成した仮想マシンをホスト起動時に自動起動させたかったのでそのためのメモです。(VMware Fusion 6.0.1で確認)

VMをコマンドラインで起動させる方法

VMware Fusion内にあるvmrunコマンドを使用します。

Terminal
$ /Applications/VMware\ Fusion.app/Contents/Library/vmrun start /path/to/vm.vmwarevm/vm.vmx

headlessモードで起動したい場合はnoguiをつけます。

Terminal
$ /Applications/VMware\ Fusion.app/Contents/Library/vmrun start /path/to/vm.vmwarevm/vm.vmx nogui

VMを安全にシャットダウンさせるために

OS Xのlaunchdはデーモンプロセス終了時にSIGTERMを送ってきます。(参考: Daemons and Services Programming Guide)
そのため、vmxファイルにSignalに関する設定を追記します。

vm.vmx
signal.suspendOnHUP = "TRUE"
signal.poweroffOnTERM = "TRUE"

launchdのことだけを考えるならsignal.suspendOnHUPの設定はいらないのですが、一応。
この設定を行ってlaunchdからVMを起動し、launchctl stopを行った場合、VMはシャットダウン処理を行って終了するようになります。

10
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?