On Fri, 2 Feb 2018, Bernhard wrote:

> Did by chance someone write a dom0-script that
> 
> a) fetches a list of all (running) appvm's that use sys-net.
> 
> b) setting their net-vm to "none"
> 
> c) reboot sys-net
> 
> d) undoes step (b)
> 
> That would allow to confortably reboot sys-net (same ideas apply to
> sys-firewall & sys-whonix) and could help many people in many
> situations. I am not a bash hero, and before losing half a day on this
> useful script, I prefer asking if someone did it already :)

I didn't have it already but it wasn't too difficult to do so I wrote one 
as it seems somewhat useful.


-- 
 i.

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/alpine.DEB.2.20.1802021230410.15025%40whs-18.cs.helsinki.fi.
For more options, visit https://groups.google.com/d/optout.
#!/bin/sh

vm="sys-net"
[ $# -ge 1 ] && vm="$1"

echo "Restarting $vm..."

explicitlist=$(qvm-ls --raw-data state netvm name-raw | \
        grep -e "^Running|$vm|" | cut -d '|' -f 3)

defaultlist=$(qvm-ls --raw-data state netvm name-raw | \
        grep -e "^Running|[*]$vm|" | cut -d '|' -f 3)

for i in $explicitlist $defaultlist; do
        qvm-prefs -s $i netvm none
done

qvm-shutdown --wait "$vm"
qvm-start "$vm"

for i in $explicitlist; do
        qvm-prefs -s $i netvm "$vm"
done

for i in $defaultlist; do
        qvm-prefs -s $i netvm default
done

Reply via email to