From 283164766b1e697337afc0878d6aff13f965e1d8 Mon Sep 17 00:00:00 2001 From: Irina Gómez Date: Mon, 20 Jan 2020 13:00:42 +0100 Subject: #914 #811 Fixs error in setclientmode: getcaller function is included for detect parent process (program or script). --- server/lib/ogfunctions.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server') diff --git a/server/lib/ogfunctions.sh b/server/lib/ogfunctions.sh index 4b61166b..c630e41f 100755 --- a/server/lib/ogfunctions.sh +++ b/server/lib/ogfunctions.sh @@ -84,6 +84,12 @@ EOT rm -f "$MYCNF" } +# Returns parent process name (program or script) +function getcaller () { + basename "$(COLUMNS=200 ps hp $PPID -o args | \ + awk '{if ($1~/bash/ && $2!="") { print $2; } + else { sub(/^-/,"",$1); print $1; } }')" +} ### Meta-functions and private functions. -- cgit v1.2.3-18-g5258