Projet

Général

Profil

Révision a2f1592f

IDa2f1592fe5a1dd286d2ea31f9842c25ac3b280fc
Parent b31b861f
Enfant a9476f50

Ajouté par Tomaz Solc il y a environ 9 ans

systemd_units: avoid use of temporary file

Voir les différences:

plugins/system/systemd_units
60 60
}
61 61

  
62 62
fetch () {
63
	tmp=$(mktemp -t munin-systemd_units.XXXXXX)
64
	trap "rm \"$tmp\"" EXIT
65
	systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp"
63
	tmp=$(systemctl --no-pager --no-legend --all | awk '{print $1, $3}')
66 64
	for state in \
67 65
		$states ; do
68 66
	echo -n "$state.value "
69
	grep -c "$state$" "$tmp"
70
	extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1)
67
	echo "$tmp" | grep -c "$state$"
68
	extinfo=$(echo "$tmp" | grep "$state$" | cut -d " " -f 1)
71 69
	if [ -n "$extinfo" ]; then
72 70
		echo "$state.extinfo" $extinfo
73 71
	fi

Formats disponibles : Unified diff