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.

Scripting VM Start / Stop?

Featured Replies

So, we can boot UnRaid in GUI mode and then boot into a VM on the same GPU.

However, when the VM quits, we don't get the unRaid GUI back (so we're 'stuck')

 

I'm wondering if there's a way to 'script' a sequence so that booting up a different VM could be achieved from within a VM?

 

Consider a single GPU server;

1. User boots to unRAID GUI

2. User launches Windows 10 VM from unRAID UI

3. Within Windows VM, users runs script to launch OSX VM (could be on desktop, could be part of unRaid browser UI)

4. Script shuts down Windows VM, waits a few seconds, then launches OSX VM

5. Voila, user sees OSX boot on same system/screen

 

Any thoughts, pointers?

 

(I guess I'm thinking about some kind of VM Switcher functionality)

Edited by meep
clarity

  • 3 weeks later...

It's pretty easy.

 

#!/bin/bash



virsh stop <windows vm name>

sleep 10

virsh start <macos vm name>

 

A few more notes:

  • To run the script from desktop, you can use Putty and a bat file to automatically SSH into the server and execute the script. Normally, the SSH password is in plain text in the bat file which is a security risk so you might want to set up a public key login (can't remember how I did it but remember there was a post on the forum so you will need a bit of searching).
  • Win10 VM generally co-operates with virsh stop but I have found OSX VM to be less co-operative. So what I have done in the past is to lengthen the wait time (i.e. longer than a typical shutdown) and then use virsh destroy to guarantee the OSX VM shutdown (virsh destroy is equivalent of turning off the power)
  • If VM name has space then use double quote. You can also use uuid.

So assuming the typical shutdown time is 10s then I'll add 5s to the wait time just to be safe. Script will be something like this:

#!/bin/bash
virsh stop "VM1 name"
sleep 15s
virsh destroy "VM1 name"
virsh start "VM2 name"

 

Edited by testdasi

  • 1 year later...
tmp=$(virsh list --all | grep " vmtest " | awk '{ print $3}')
if ([ "x$tmp" == "x" ] || [ "x$tmp" != "xrunning" ])
then
    echo "VM does not exist or is shut down!"
    # Try additional commands here...
else
    echo "VM is running!"
fi

code similar to this in hourly schedule.

Archived

This topic is now archived and is closed to further replies.

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.