1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

systemd_units: avoid use of temporary file

This commit is contained in:
Tomaz Solc 2016-10-27 17:49:03 +02:00
parent b31b861f1c
commit a2f1592fe5

View file

@ -60,14 +60,12 @@ EOF
}
fetch () {
tmp=$(mktemp -t munin-systemd_units.XXXXXX)
trap "rm \"$tmp\"" EXIT
systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp"
tmp=$(systemctl --no-pager --no-legend --all | awk '{print $1, $3}')
for state in \
$states ; do
echo -n "$state.value "
grep -c "$state$" "$tmp"
extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1)
echo "$tmp" | grep -c "$state$"
extinfo=$(echo "$tmp" | grep "$state$" | cut -d " " -f 1)
if [ -n "$extinfo" ]; then
echo "$state.extinfo" $extinfo
fi