From 08e12be1c14ba5c46657c63d6894356590187bc6 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Tue, 30 Jan 2024 08:57:11 +0000 Subject: [PATCH] Avoid useless processes launching shell There's no reason to keep 3 shell processes to execute one. Remove "()" in command to avoid one additional process. Add "exec" on last command to replace current process. Remove exports, not necessary as changing one single command environment. This changes this: $ pstree -alp | grep -4 bash ... |-python,2051 /usr/lib64/xsconsole/XSConsole.py -f root | `-sh,3238 -c ( export HOME=/root; export TMOUT=300 && cat /etc/motd && /bin/bash --login ) | `-sh,3239 -c ( export HOME=/root; export TMOUT=300 && cat /etc/motd && /bin/bash --login ) | `-bash,3241 --login ... to this: $ pstree -alp | grep -4 bash ... |-python,2044 /usr/lib64/xsconsole/XSConsole.py -f root | `-bash,3128 --login ... Signed-off-by: Frediano Ziglio --- plugins-base/XSFeatureLocalShell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins-base/XSFeatureLocalShell.py b/plugins-base/XSFeatureLocalShell.py index ce33e7c..6f66214 100644 --- a/plugins-base/XSFeatureLocalShell.py +++ b/plugins-base/XSFeatureLocalShell.py @@ -32,7 +32,7 @@ def StartLocalShell(self): user = os.environ.get('USER', 'root') Layout.Inst().ExitBannerSet(Lang("\rShell for local user '")+user+"'.\r\r"+ Lang("Type 'exit' to return to the management console.\r")) - Layout.Inst().SubshellCommandSet("( export HOME=/root; export TMOUT="+str(State.Inst().AuthTimeoutSeconds())+" && cat /etc/motd && /bin/bash --login )") + Layout.Inst().SubshellCommandSet("cat /etc/motd && HOME=/root TMOUT="+str(State.Inst().AuthTimeoutSeconds())+" exec /bin/bash --login") XSLog('Local shell') @classmethod