[英]Can I run a script on my Pi and keep it running when I close SSH?
I have a Raspberry Pi running Debian Lite (terminal only, no desktop). 我有一个运行Debian Lite的Raspberry Pi(仅限终端,没有桌面)。 I've installed Node.js and am currently running a script by making an SSH connection through puTTY. 我已经安装了Node.js,目前正在通过puTTY建立SSH连接来运行脚本。
The problem is, when I close the puTTY window the script stops running. 问题是,当我关闭PuTTY窗口时,脚本停止运行。 I need it to run when my desktop is turned off, otherwise having it on the Pi is pointless. 我需要在桌面关闭时运行它,否则在Pi上安装它毫无意义。
So far I have tried: -Nohup | 到目前为止,我已经尝试过:-Nohup | Appended the output but still stopped running when I closed the terminal. 追加了输出,但是当我关闭终端时仍然停止运行。
Multiple options: 多种选择:
Install screen
or tmux
on the PI and start the job with those programs. 在PI上安装screen
或tmux
,然后使用这些程序启动作业。
(or) Run the job with the nohup
command: (或)使用nohup
命令运行作业:
nohup command
(or) Run the job in the background and use disown
: (或)在后台运行作业并使用disown
:
command &
disown %1
I recommend option 1. 我建议选择1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.