meep Posted July 8, 2019 Share Posted July 8, 2019 (edited) 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 July 8, 2019 by meep clarity Quote Link to comment
Jagadguru Posted July 30, 2019 Share Posted July 30, 2019 It's pretty easy. #!/bin/bash virsh stop <windows vm name> sleep 10 virsh start <macos vm name> Quote Link to comment
testdasi Posted July 30, 2019 Share Posted July 30, 2019 (edited) 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 July 30, 2019 by testdasi Quote Link to comment
mdsloop Posted September 21, 2020 Share Posted September 21, 2020 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. 1 Quote Link to comment
Recommended Posts
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.