summaryrefslogtreecommitdiff
path: root/.local/bin/kill-libvirtd
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2022-02-12 17:54:06 -0500
committerSam Chudnick <sam@chudnick.com>2022-02-12 17:54:06 -0500
commitb0a2c1c5800c30ecf37311885ce11f244102873e (patch)
tree49329a7af06795ff5fb16479d7c3dfe3441555ee /.local/bin/kill-libvirtd
parenta7ec0d3b3e49837c52051de489b118b650bb2bf0 (diff)
Bunch of changes
Diffstat (limited to '.local/bin/kill-libvirtd')
-rwxr-xr-x.local/bin/kill-libvirtd22
1 files changed, 22 insertions, 0 deletions
diff --git a/.local/bin/kill-libvirtd b/.local/bin/kill-libvirtd
new file mode 100755
index 0000000..2ea802d
--- /dev/null
+++ b/.local/bin/kill-libvirtd
@@ -0,0 +1,22 @@
1#!/bin/sh
2# Stop all running domains and networks, and then stop all libvirtd daemons
3
4# Save running domains
5rundoms="$(virsh list | grep running | awk '{print $2}')"
6for dom in $rundoms
7do
8 virsh managedsave $dom
9done
10
11# Stop network
12virsh net-destroy default
13
14# Stop libvirtd
15sudo systemctl stop libvirtd >/dev/null
16sudo systemctl stop libvirtd-ro.socket >/dev/null
17sudo systemctl stop libvirtd-admin.socket >/dev/null
18sudo systemctl stop libvirtd.socket >/dev/null
19sudo systemctl stop virtlogd >/dev/null
20sudo systemctl stop virtlogd-admin.socket >/dev/null
21sudo systemctl stop virtlogd.socket >/dev/null
22sudo systemctl stop systemd-machined >/dev/null