So I'm aware that this is a somewhat convoluted usecase with probably not many practical applications, so unfortunately I wasn't able to find many helpful pointers so far.
Basically, I would like to have a terminal-only session that automatically runs a CLI application after login, and keeps restarting this application after a set amount of time (e.g. 1 minute) whenever it exits. For the duration where the application is exited, the shell should be regularly usable.
So here's my current setup (which works nicely so far):
- I have a terminal-only session (no GUI, linux mint in this case).
- After logging in, I automatically run an interactive CLI application (easy to do by adding it to .bashrc for example)
- After the user exits my CLI application, they are back in their regular bash terminal and able to run commands (as they should)
Now the tricky part which I was unable to figure out so far:
- How can I automatically restart the application in the user's terminal after a short time, while still keeping the terminal usable before that timeout is reached?
- We can assume that the user won't be doing anything in the bash that could break things (such as starting additional shells, exiting running processes or logging out). They have to be able to run 1-2 other commands that complete quickly, but not much else.
I tried accomplishing this by running a script that (in a loop) alternates between running the application and running the timeout
command that should start a new bash, but was unable to get it right. It doesn't seem to be possible to start an interactive bash session using the timeout command. So this might be one possible way to do it (pointers on the correct syntax are welcome), but any other approach or idea is also perfectly fine.
{}
tool from the Edit menu on the mouse-selected text aof your script so you getcode/data/output/errMsg
formatting. Good luck.