[SOLVED] Execute host command after starting guest.

das1996

Member
May 26, 2021
62
8
13
123
Last edited:
After some more research discovered the concept of hookscripts. There's several different states, for this purpose "POST-START" seemed most appropriate. Maybe there's a simpler more elegant way of doing this?

The process involves the following

1) Enable snippets
Datacenter, storage, local
under content, highlight snippets

2) copy hookscript example to snippets
cp /usr/share/pve-docs/examples/guest-example-hookscript.pl /var/lib/vz/snippets/somefilename.pl

3) edit /var/lib/vz/snippets/somefilename.pl
Under POST-START

add the following - adjust id/interface as needed
Code:
    # set bridge flags to pass eapol traffic
        system("echo 8 > /sys/class/net/vmbr1/bridge/group_fwd_mask");
        system("echo 8 > /sys/class/net/fwbr105i1/bridge/group_fwd_mask");

4) associate script with guest vm
qm set 105 --hookscript local:snippets/somefilename.pl
 
  • Like
Reactions: pvps1

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!