Replies: 2 comments 1 reply
-
Hmm... I don't know if you can script the login 🤔 Only thought that comes to mind is disabling the login with cc @oxy @code-asher any ideas? |
Beta Was this translation helpful? Give feedback.
-
I have not tested any of this but here are my thoughts.
You could use your current method but detect if you are already in a login shell in order to avoid the loop. Bash will set
Another idea is to change a setting in code-server that makes the shell spawn as a login shell by adding a flag. For Bash this flag is
If I understand correctly you want If you use the first method above you can add If you use the second method nothing further needs to be done. |
Beta Was this translation helpful? Give feedback.
-
Hi code-server team,
This is about some linux oriented scripting automation. My code-server instance runs on a pre-emptible compute engine instance. Because of this I want to provide a shutdown script which uses linux's wall program to alert all logged in users that a pre-emption request was issued.
wall "Pre-emption detected. Please save your work!"
For the wall command to work, the user must set mesg y and must be logged in to the shell. The setting of mesg to y is done via the user's ~/.profile. My current problem is that I can't script the "login". I tried adding a sudo login -f $USER but this didn't work. instead it logged the user into the same shell over and over and over nonstop.
I have two questions:
(a) How would I go about logging a shell user in automatically and
(b) How can I perform a shell "teardown" such that if I close a shell via exit or closing the shell the user is then logged out of that shell..?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions