Running Script on VM startup


DeeR

Recommended Posts

  • 2 months later...

I had the same question when Googling around today.  After reading @jonathanm's response, I investigated and found this: https://libvirt.org/hooks.html which looks promising!

 

I am interested in the possibility of releasing hardware from other processes (i.e. dockers) I want to provide to a VM, but leave available when not in use.

 

I don't have an UnRaid server (contemplating the migration) so I am interested if this works with the current build of the OS.  Care to check and report back @DeeR?

 

-JesterEE

Link to comment
  • 2 years later...

This isn't the most elegant solution but it works for me.

 

I wanted to run a script when my VM started up to switch the scaling_governor from ondemand to performance when my gaming VM was running.

 

I took @JonathanMs suggestion to use virsh list.  Then setup a User Script to run every 5 minutes. If all the settings are already right, it does nothing, otherwise it will update the system.

 

You can see the script here: https://github.com/Goobaroo/unraid-setCPUgovernor

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.