гd like to start в screen
session inside an LXD-managed контейнер so that I could detach running processes and maybe re-attach in the future when I want to check on their статус.
I tried to attach to the контейнер running
$ lxc exec my-ubuntu -- /bin/bash
and then start в session with screen -x
, but I get the following ошибка:
Must be connected to a terminal.
I хан see that many people have had в сходный problem when trying to initiate screen
from ssh
, but I couldn't apply the suggested solution to my вступил в брак.
Для LXD использование
lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"
или
lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x"
или с любым другим screen
переключатель.
то же для Докера ;)
docker run -it my-ubuntu sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"
Для меня простое решение было к экрану "Пуск" на хосте вместо в контейнере.
user@localhost:~$ screen
user@localhost:~$ lxc-attach -n yourcontainer
root@container:~# ./start-gameserver.sh
root@container:~# #Use "Ctrl+A:sessionname mygame<Enter>" to set a screen name
root@container:~# #and use the usual "Ctrl+A,D" to disconnect from screen
user@localhost:~$ screen -ls
There is a screen on:
25418.mygame (04/15/2019 11:41:56 PM) (Detached)
user@localhost:~$ screen -r mygame
root@container:~# #etc.