diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2020-02-10 12:09:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-10 12:09:48 +0300 |
commit | 85ff1493466223799e91864249d5b2033a7a0869 (patch) | |
tree | e862f306cd8d86b5b9b366590c81ae6726bc2c23 /collectors | |
parent | 322e66762f29d495ba0bb56ab7aec3b53e03e90f (diff) |
/collectors/charts.d.plugin: fix `os_id` detection in `run` (#8002)
Diffstat (limited to 'collectors')
-rwxr-xr-x | collectors/charts.d.plugin/charts.d.plugin.in | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/collectors/charts.d.plugin/charts.d.plugin.in b/collectors/charts.d.plugin/charts.d.plugin.in index 0df6c30c3a..0c681fd5a2 100755 --- a/collectors/charts.d.plugin/charts.d.plugin.in +++ b/collectors/charts.d.plugin/charts.d.plugin.in @@ -275,13 +275,27 @@ fixid() { tr "[A-Z]" "[a-z]" } +isvarset() { + [ -n "$1" ] && [ "$1" != "unknown" ] && [ "$1" != "none" ] + return $? +} + +getosid() { + if isvarset "${NETDATA_CONTAINER_OS_ID}"; then + echo "${NETDATA_CONTAINER_OS_ID}" + else + echo "${NETDATA_SYSTEM_OS_ID}" + fi +} + run() { local ret pid="${BASHPID}" t if [ "z${1}" = "z-t" -a "${2}" != "0" ]; then t="${2}" shift 2 - case "${NETDATA_SYSTEM_OS_ID}" in + + case "$(getosid)" in "alpine") timeout -t ${t} "${@}" 2>"${TMP_DIR}/run.${pid}" ;; |