스크린 기반 솔루션
다음과 같이 서버를 시작하십시오.
# screen -d -m -S ServerFault tr a-z A-Z # replace with your server
화면 이 분리 모드로 시작되므로 진행 상황을 보려면 다음을 실행하십시오.
# screen -r ServerFault
다음과 같이 서버를 제어하십시오.
# screen -S ServerFault -p 0 -X stuff "stop^M"
# screen -S ServerFault -p 0 -X stuff "start^M"
# screen -S ServerFault -p 0 -X stuff "^D" # send EOF
(이 답변은 텍스트 입력을 Unix & Linux 형제 사이트 에서 분리 된 화면 으로 보내는 것을 기반으로 합니다)
매개 변수 설명 :
-d -m
Start screen in "detached" mode. This creates a new session but doesn't
attach to it. This is useful for system startup scripts.
-S sessionname
When creating a new session, this option can be used to specify a meaningful
name for the session.
-r [pid.tty.host]
-r sessionowner/[pid.tty.host]
resumes a detached screen session.
-p number_or_name|-|=|+
Preselect a window. This is useful when you want to reattach to a specific
window or you want to send a command via the "-X" option to a specific
window.
-X
Send the specified command to a running screen session e.g. stuff.
물건 [문자열]
Stuff the string string in the input buffer of the current window.
This is like the "paste" command but with much less overhead. Without
a parameter, screen will prompt for a string to stuff.
TMUX 기반 솔루션
다음과 같이 서버를 시작하십시오.
# tmux new-session -d -s ServerFault 'tr a-z A-Z' # replace with your server
tmux 는 분리 모드에서 시작하므로 진행중인 작업을 보려면 다음을 실행하십시오.
# tmux attach-session -t ServerFault
다음과 같이 서버를 제어하십시오.
# tmux send-keys -t ServerFault -l stop
# tmux send-keys -t ServerFault Enter
# tmux send-keys -t ServerFault -l start
# tmux send-keys -t ServerFault Enter
# tmux send-keys -t ServerFault C-d # send EOF
매개 변수 설명 :
new-session [-AdDP] [-c start-directory] [-F format] [-n window-name] [-s
session-name] [-t target-session] [-x width] [-y height]
[shell-command]
Create a new session with name session-name.
The new session is attached to the current terminal unless -d is
given. window-name and shell-command are the name of and shell
command to execute in the initial window. If -d is used, -x and
-y specify the size of the initial window (80 by 24 if not
given).
send-keys [-lR] [-t target-pane] key ...
(alias: send)
Send a key or keys to a window. Each argument key is the name of
the key (such as `C-a' or `npage' ) to send; if the string is not
recognised as a key, it is sent as a series of characters. The
-l flag disables key name lookup and sends the keys literally.