简体   繁体   English

Bash 脚本后台执行“输入设备不是 TTY”

[英]Bash script background execution "the input device is not a TTY"

I'm getting the input device is not a TTY errors while the below command is being run in the background of my bash script.在我的bash 脚本的后台运行以下命令时,我收到输入设备不是 TTY错误。 I saw a similar issue for docker, yet there is no single post for bash scripts.我看到了 docker 的类似问题,但是 bash 脚本没有单独的帖子。 Is there any other option for running commands in the background other than using & ?除了使用&之外,还有其他选项可以在后台运行命令吗?

echo "Starting the simulation server ..."

cd simulator-server && ./simServer-VegasMixed.sh &

daemon turns any process into a daemon depending on your script you can try that. daemon 根据您的脚本将任何进程转换为守护程序,您可以尝试这样做。

There is always the option of using systemd and creating a service.始终可以选择使用 systemd 和创建服务。 It really depends on what your script is.这实际上取决于您的脚本是什么。

I have finally figured it out.我终于想通了。 I used tmux to run my command in separate sessions.我使用 tmux 在单独的会话中运行我的命令。

tmux new -d './simServer-VegasMixed.sh'

This post has also helped me a lot in solving my problem.这篇文章也帮助我解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM