From 4135f339820fca4a716399bc0d4ae8eee13fefee Mon Sep 17 00:00:00 2001 From: Harduino Date: Wed, 5 Aug 2020 12:01:37 +0300 Subject: [PATCH] siemonster :: improve determining self container id --- functions/onprem/orborus/orborus.go | 2 +- functions/onprem/worker/worker.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 983b45bd..daab7a71 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -87,7 +87,7 @@ func getThisContainerId() string { } if fCol != "" { - cmd := fmt.Sprintf("head -1 /proc/self/cgroup | cut -d/ -f%s", fCol) + cmd := fmt.Sprintf("cat /proc/self/cgroup | grep memory | tail -1 | cut -d/ -f%s", fCol) out, err := exec.Command("bash","-c",cmd).Output() if err == nil { containerId = strings.TrimSpace(string(out)) diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index dce95db1..6824434a 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -415,7 +415,7 @@ func shutdown(executionId, workflowId string) { // form container id of current running container func getThisContainerId() string { containerId := "" - cmd := fmt.Sprintf("head -1 /proc/self/cgroup | cut -d/ -f3") + cmd := fmt.Sprintf("cat /proc/self/cgroup | grep memory | tail -1 | cut -d/ -f3") out, err := exec.Command("bash","-c",cmd).Output() if err == nil { containerId = strings.TrimSpace(string(out))