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.

How to start/stop all VMs except one

Featured Replies

I need help with a script.

I need a script where I can shutdown/start all VMs except one.

I know about start/stopping via virsh, but I cant find information how to do this on all except one particular. 

Not sure if there is a comand to shutdown all except of one but you can virsh shutdown one by one. simply add a line for each VM in your script.

  • Author
Just now, bastl said:

Not sure if there is a comand to shutdown all except of one but you can virsh shutdown one by one. simply add a line for each VM in your script.

Yeah I know how to do this, with a manual VM-list, but I dont want to edit that one, each time I create or edit my VMs. 

  • Author

Figured it out :)

 

In case anyone wants it

VM-Shutdown:
 

#!/bin/bash

#Empty vm list
echo "" > /tmp/vms-running.txt

#Get all running vms except backup server
for VM in $(virsh list --state-running --name); do
  if [[ ! "$VM" == "VM-TO-NOT-SHUTDOWN" ]] ; then
    virsh shutdown "$VM"

#Write running vms to list
echo "$VM" >> /tmp/vms-running.txt

fi
done
  
/usr/local/emhttp/webGui/scripts/notify -i normal -s "Veeam started - VMs shutdown"

 

VM-Start:

#!/bin/bash

#Get all running vms except backup server
for VM in $(cat /tmp/vms-running.txt); do
  virsh start "$VM"

done

/usr/local/emhttp/webGui/scripts/notify -i normal -s "Veeam done - VMs started"

 

Edited by ZataH

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.