• Welcome to LiuJason's Blog!

Laptop as Proxmox VE host passthrough GPU to Windows VM and start the VM on hardware event

Linux笔记 Jason 2 years ago (2023-05-15) 283 Views 0 Comments QR code of this page
文章目录[隐藏]

[This tutorial is still working in progress]

Start the VM on hardware event

In my case, I don't use the SD card in daily workflow and it's nice to be used as a "switch". You can always use a handy USB device as an event trigger.
Create a service called `start-on-remove-sd`:

sudo nano /etc/systemd/system/start-on-remove-sd.service

Replace the contents of the file with the following:

[Unit]
Description=Start VM on SD card removal
After=network.target

[Service]
ExecStart=/usr/bin/bash -c "journalctl -fn0 | grep --line-buffered 'mmc0: card 0007 removed' | while read -r line; do qm start 106; done"

[Install]
WantedBy=default.target

Save the file and exit the text editor. Reload the systemd daemon to apply the changes:

sudo systemctl daemon-reload

Enable and start the service using the following commands:

sudo systemctl enable start-on-remove-sd.service
sudo systemctl start start-on-remove-sd.service

This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/1240.html
Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址