即使我注销,如何在后台继续运行 unix 程序? [英] How can I keep running a unix program in the background even if I log out?

查看:27
本文介绍了即使我注销,如何在后台继续运行 unix 程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 unix 机器上在后台运行一个带有一些 while(1) 循环的 Perl 脚本,直到我杀死它.

I want to run a Perl script with some while(1) loop in the background on a unix machine until I kill it.

这是一台我没有管理权限的远程计算机(因此出于某种原因,我不能使用 Daemon::Generic::While1),我通过 SSH 登录到它,我希望它继续退出后运行.

This is a remote computer to which I don't have administrative permissions (so for some reason, I can't use Daemon::Generic::While1), I log to it through SSH, and I want it to continue to run after I log out.

我发现的一种方法是向 bash 写这样的东西:

One way I found out is write something like this to bash:

nohup ./my_script.pl &

还有其他更可取的方法吗?

Is there some other, more preferable way to do it?

禁止在该计算机上编辑 crontab(而运行后台和持久进程则不是).

Editing the crontab is forbidden on that computer (while running background and long-lasting processes isn't).

推荐答案

我的首选方法,可以说是最简单的方法,是使用 screen:

My preferred method, and arguably the easiest, is using screen:

screen -d -m ./myProcess

这篇关于即使我注销,如何在后台继续运行 unix 程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆