Run custom command after VM start?

SirMaster

Renowned Member
May 20, 2015
23
2
68
I am looking for a way to run a custom shell command as root automatically sometime after a VM is started.

I need the command to be run at least after the main KVM process and all it's threads have been created.

The command I want to run is this:

Code:
ls /proc/$(pgrep -f nick-htpc)/task | xargs -n 1 chrt -f -p 1

Anyone have any suggestions for how I can trigger this command to run after a VM has been started?

It doesn't even have to be only after a specific VM is started since the command will only affect a specific VM's PIDs. However that would be a bonus if the way can be set to only run for a specific VM as that might come in handy in the future.

Thanks
 
Not really.

What I did for now was to create a script inside the VM that runs when the VM starts up and that connects to Proxmox via SSH and runs my command.