summaryrefslogtreecommitdiff
path: root/.local/bin/kill-libvirtd
blob: 2ea802dd7d60e5776d4b6838ccbb08dec6b863df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Stop all running domains and networks, and then stop all libvirtd daemons

# Save running domains
rundoms="$(virsh list | grep running | awk '{print $2}')"
for dom in $rundoms
do
	virsh managedsave $dom
done

# Stop network
virsh net-destroy default

# Stop libvirtd
sudo systemctl stop libvirtd >/dev/null
sudo systemctl stop libvirtd-ro.socket >/dev/null
sudo systemctl stop libvirtd-admin.socket >/dev/null
sudo systemctl stop libvirtd.socket >/dev/null
sudo systemctl stop virtlogd >/dev/null
sudo systemctl stop virtlogd-admin.socket >/dev/null
sudo systemctl stop virtlogd.socket >/dev/null
sudo systemctl stop systemd-machined >/dev/null