我如何在不使用crontab的情况下在后台连续运行Unix脚本.

编程入门 行业动态 更新时间:2024-10-14 16:22:47
本文介绍了我如何在不使用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脚本.

本文发布于:2023-11-24 00:15:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623284.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   后台   情况下   如何在   crontab

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!