我如何在不使用crontab的情况下在后台连续运行Unix脚本. [英] how can I continously run a unix script in background without using crontab.
问题描述
如何不使用crontab连续在后台运行脚本.该脚本即使在我注销后也应该运行,并且在系统重新启动后仍无法启动时可以接受.我是unix的新手.
how can I continously run a script in background without using crontab. The script should run even after I logout and is acceptable if it doesen't start after system reboot.I am new to unix.
推荐答案
There's a couple of ways of doing this but the neatest way is to use screen. This lets you create a session which lives perminently on the machine and you can simply reconnect to to check on the progress of your long running process.
如果您不想使用 screen
,则可以使用 nohup
,这使您可以运行以下任务:
If you don't wish to use screen
you can use nohup
this allows you to run a task like:
nohup mytask&
您的任务现在将在后台运行,并且在注销后仍将保留,但是与 screen
不同,您无法再次控制它.
Your task will now run in the background and will survive a log off, however there's no way to take control of it again, unlike with screen
.
这篇关于我如何在不使用crontab的情况下在后台连续运行Unix脚本.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!