siemonster :: improve determining self container id
This commit is contained in:
@@ -87,7 +87,7 @@ func getThisContainerId() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fCol != "" {
|
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()
|
out, err := exec.Command("bash","-c",cmd).Output()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
containerId = strings.TrimSpace(string(out))
|
containerId = strings.TrimSpace(string(out))
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ func shutdown(executionId, workflowId string) {
|
|||||||
// form container id of current running container
|
// form container id of current running container
|
||||||
func getThisContainerId() string {
|
func getThisContainerId() string {
|
||||||
containerId := ""
|
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()
|
out, err := exec.Command("bash","-c",cmd).Output()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
containerId = strings.TrimSpace(string(out))
|
containerId = strings.TrimSpace(string(out))
|
||||||
|
|||||||
Reference in New Issue
Block a user