bash 使用 ubuntu 在启动时启动屏幕会话

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1424731/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 21:12:16  来源:igfitidea点击:

Starting a screen session on startup with ubuntu

bashubuntugnu-screen

提问by WedTM

I'm using amazon EC2 for a service that I'm starting, however when I try and start a screen session during the startup script (which is ran during the bootup process) the screen never gets started. I've made sure to run apt-get install screen -y, however I'm not sure how to make the screen start correctly.

我正在将 amazon EC2 用于我正在启动的服务,但是当我尝试在启动脚本(在启动过程中运行)期间启动屏幕会话时,屏幕永远不会启动。我已经确保运行 apt-get install screen -y,但是我不确定如何让屏幕正确启动。

Any help?

有什么帮助吗?

-UPDATE-

-更新-

here's the output from my manual screen command, I must not be typing the right something...

这是我的手动屏幕命令的输出,我不能输入正确的东西......

root@ip-10-245-118-68:~# screen -A -m -d -S game ./game/orangebox/srcds_run -console -game tf -autoupdate
root@ip-10-245-118-68:~# screen -ls
No Sockets found in /var/run/screen/S-root.

root@ip-10-245-118-68:~# 

采纳答案by Paused until further notice.

You are starting screendetached. What happens if you try screen -lsto list your screensessions or reattach using screen -ror similar?

你开始screen分离了。如果您尝试使用或类似方法screen -ls列出screen会话或重新附加会发生什么screen -r

The first time a user runs screen, it prompts for a profile and creates $HOME/.screenrcand $HOME/screen-profileswith some files under it.

在用户第一次运行screen,它会提示一个配置文件,并创建$HOME/.screenrc$HOME/screen-profiles使用其下的一些文件。

Go ahead, as rootand let it do that then try your startup again. Maybe it's hanging at that prompt.

继续,root让它这样做,然后再次尝试启动。也许它挂在那个提示上。

You need to put an absolute path for your ./game/orangebox/srcds_run. Instead of dot, change that to /path/to/program

您需要为您的./game/orangebox/srcds_run. 而不是dot,将其更改为/path/to/program

回答by ckruslicky

The problem of screen waiting for you to press enter can presumably be fixed in /etc/screenrc or in the user running your script via screen in $HOME:

screen 等待您按 Enter 的问题大概可以在 /etc/screenrc 或通过 $HOME 中的 screen 运行脚本的用户中修复:

    # cat .screenrc 
    startup_message off