如何不使用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脚本.
发布评论