diff options
author | Irina Gómez <irinagomez@us.es> | 2020-01-20 13:00:42 +0100 |
---|---|---|
committer | Irina Gómez <irinagomez@us.es> | 2020-01-20 13:00:42 +0100 |
commit | 283164766b1e697337afc0878d6aff13f965e1d8 (patch) | |
tree | 624842f21d271bd45ef040deb828316c4f9b6299 /server | |
parent | 3964e74327cd415c677c3d4ad3e25ce5d74d762b (diff) |
#914 #811 Fixs error in setclientmode: getcaller function is included for detect parent process (program or script).
Diffstat (limited to 'server')
-rwxr-xr-x | server/lib/ogfunctions.sh | 6 |
1 files changed, 6 insertions, 0 deletions
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. |