1
0
mirror of https://github.com/limosek/zaf-plugins.git synced 2024-11-01 08:17:19 +01:00
limosek-zaf-plugins/psx/control.zaf
2016-12-05 12:22:44 +01:00

43 lines
853 B
Plaintext

Plugin: psx
Description::
Plugin which will make deeper look to processess and their usage.
::
Version: 0.2
Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/psx
Web: https://github.com/limosek/zaf-plugins/
Maintainer: Lukas Macura <lukas@macura.cz>
# Dependencies
Depends-dpkg: dash
Depends-opkg: busybox
Depends-bin: ps
Item discovery:
Description::
Discovery of runing processes
::
Testparameters: ps systemd,root
Parameters::
pregex '.*' '' # regexp to match process name
uregex '.*' '' # regexp to match user name
::
Script::
if [ "${ZAF_PKG}" = "opkg" ]; then
AWK='{ print $5" "$2; }'
PS="w"
else
AWK='{ print $11" "$1; }'
PS="--no-headers caux"
fi
ps $PS | awk "$AWK" | sort | uniq | sed -e 's/\//\\\//g' -e '$s/.$//' | grep -E "^$pregex" | grep -E "$uregex\$" | zaf_discovery '{#PSNAME}' '{#PSUSER}'
::
/Item