dotfiles/files/dom0/.local/bin/dom0/qvm-stats-short
Ben Grande b38834d66b
fix: avoid operand evaluation as argument
Explicit end option parsing as the shell can be quite dangerous without
it.
2024-08-06 17:13:11 +02:00

19 lines
855 B
Bash
Executable File

#!/bin/sh
# SPDX-FileCopyrightText: 2018 one7two99 <https://github.com/one7two99>
# SPDX-FileCopyrightText: 2018 Ivan <https://github.com/taradiddles>
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-only
## Credits: https://github.com/Qubes-Community/Contents/blame/master/code/monitoring/ls-qubes.sh
## Output: 9Q|13.3G -> 9 Qubes running with 13.3GB of total RAM consumption.
## The output of this script can be placed in the Xfce top bar, via:
## 1) Right Click on bar > Panel > Add new items > Generic Monitor > Add
## 2) Right click on the newly added monitor and choose properties.
## 3) Add this script to the command field.
xl list | awk -- '
BEGIN { mem=0; qubes=0; } / [0-9]+ +[0-9]+ +[0-9]+ / { mem+=$3; qubes++; }
END { printf("%dQ|%.1fG\n", qubes, mem/1000); }'