Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process terminates on webpage exit #53

Closed
LoganDark opened this issue Apr 13, 2017 · 15 comments
Closed

process terminates on webpage exit #53

LoganDark opened this issue Apr 13, 2017 · 15 comments

Comments

@LoganDark
Copy link

How do I stop this? (Even if it is not a bug)

@tsl0922
Copy link
Owner

tsl0922 commented Apr 13, 2017

This is expected, as well as ssh does. You may use tools like nohup to keep process running in background.

@LoganDark
Copy link
Author

LoganDark commented Apr 13, 2017

nohup makes my docker process stay alive after ttyd ends. and then I have to kill it manually, how do I fix this?

@LoganDark
Copy link
Author

ttyd just kills the process when the browser closes, I want it to stay open after the webpage closes but I still want it to close when I kill ttyd.

@tsl0922
Copy link
Owner

tsl0922 commented Apr 13, 2017

Not support, this seems not the use scene of ttyd.

@LoganDark
Copy link
Author

I mean like where I can visit the webpage at any time and have access to the running process

@tsl0922
Copy link
Owner

tsl0922 commented Apr 13, 2017

I want it to stay open after the webpage closes but I still want it to close when I kill ttyd

This is not possible, ttyd always send quit signal to process when client disconnected. if you want to share one terminal with multiple users, you can use a terminal multiplexer like tmux, for example: ttyd tmux new -A -s ttyd vim.

@LoganDark
Copy link
Author

LoganDark commented Apr 13, 2017

nope, not what I want. what I want is a session I can always connect to in the browser. i'm not going to be sharing it with others.

sorry if i'm bothering you, but you don't seem to understand what I want

@tsl0922
Copy link
Owner

tsl0922 commented Apr 13, 2017

I Understood, but it is not possible for ttyd right now, so I gave you some workarounds.

What you want is something like tmux session managed by ttyd which maps connect to attach, disconnect to detach?

@LoganDark
Copy link
Author

LoganDark commented Apr 13, 2017

can't you just add like a --nokill option, something likeDoesn't shut down process on client disconnect?

i'd add that option myself but i have no idea how :/

@tsl0922
Copy link
Owner

tsl0922 commented Apr 14, 2017

No. ttyd doesn't store session, if it Doesn't shut down process on client disconnect, that process will be stale, we can't identify which client it belongs to.

@LoganDark
Copy link
Author

I give up...

@wuestkamp
Copy link

Would it be possible to put an (Nginx) proxy in front which always keeps the connection alive and accepts coming and going connections and transfers these to the same session? For the ttyd it would just seem that there is one long-running connection. Anyone got experience with this?

@devopswise
Copy link

I am looking for same functionality. I need to keep the session running and access whenever I need to, using browser. I appreciate if there are any updates or ideas? Many thanks

@dmartin
Copy link
Contributor

dmartin commented Mar 13, 2023

I agree with the maintainer, this feature doesn't really make sense to handle in ttyd. It can be done with tools designed for running persistent sessions:

# start some persistent background terminal session (could also use tmux, Docker, etc)
screen -dmS htop-session htop

# attach to it when users connect to ttyd
ttyd bash -c 'screen -r htop-session'

@devopswise
Copy link

I also agree with the maintainer and many thanks for the solution @dmartin
In case somebody needs it, here I am leaving a link to my image

https://github.com/devopswise/wspacer-basic-workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants