Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Running Script on VM startup

Featured Replies

Hi all, 

 

Is there a way to schedule a script run when a specific VM starts up ?

Yes.

Parse the output of virsh list and when the VM in question changes to running, run the desired action.

Probably need to think through timing and retriggering.

 

There may be other better methods, but it's definitely possible to accomplish what you want, given the tools available right now.

  • Author

Hi Jonathanm

 

Thanks for the reply, could you give me abit more detail into how to parse the virsh list?

Is there an unraidy way? Or just a cron a script ? That checks previous state, etc..

  • 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

  • 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

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.