我如何在不使用crontab的情况下在后台连续运行Unix脚本. [英] how can I continously run a unix script in background without using crontab.

查看:51
本文介绍了我如何在不使用crontab的情况下在后台连续运行Unix脚本.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何不使用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屋!

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