pes*_*olo 3 bash signals gnu-screen send
如何将 CTRL-A 和 CTRL-D 信号从 shell 脚本发送到屏幕?下一个代码对我不起作用。屏幕进程仍在前台运行,我希望它在后台执行。任何想法?
#!/bin/sh
#TweetBot notifications with Growl
cd ~/node-tweetbot/
screen -S "tweet" node app.js -X stuff "'^A' '^D'"
Run Code Online (Sandbox Code Playgroud)
screen您可以简单地以分离模式启动。从手册页:
-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.
Run Code Online (Sandbox Code Playgroud)
所以这:
screen -S tweet -d -m node app.js
Run Code Online (Sandbox Code Playgroud)
将启动您的屏幕会话分离。您可以稍后通过运行以下命令附加到它:
screen -x tweet
Run Code Online (Sandbox Code Playgroud)