mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
systemd_units: avoid use of temporary file
This commit is contained in:
parent
b31b861f1c
commit
a2f1592fe5
1 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue