man页面wget说
NAME
Wget - The non-interactive network downloader.
DESCRIPTION
Wget is non-interactive, meaning that it can work in the background,
while the user is not logged on. This allows you to start a retrieval
and disconnect from the system, letting Wget finish the work. By
contrast, most of the Web browsers require constant user's presence,
which can be a great hindrance when transferring a lot of data.wget是我所知道的非交互式程序的一个例子。现在我的问题是,
wget?发布于 2013-03-11 01:26:29
在没有用户登录的情况下,如何使用wget?
通过在守护进程/服务或程序中包含wget命令,您作为用户不启动下载。
非交互程序是如何工作的?
当您创建一个deamon并使这个守护进程处于活动状态时,它可以继续探测服务器并请求下载。如果服务器死了,当服务器备份时,非交互程序将继续运行,而不需要用户操作。
例如,更新Ubuntu可以不需要用户的任何操作,甚至无需登录。
发布于 2013-03-11 06:18:20
对我来说,在没有登录的情况下运行事物的最简单方法是在crontab文件中包含一行:
# m h dom mon dow command
*/30 * * * * test -x /home/koju/bin/yourscript && /home/koju/bin/yourscript当你的脚本找不到的时候,测试就是不要让cron通过电子邮件抱怨。关于第一个字段的格式,请查看man 5 crontab。
从yourscript调用wget,因为它是非交互式的,因此它不会通过请求输入来提示您进行交互。只要wget的命令行选项为您提供所需的信息,上述设置将每30分钟为您运行一次。
当然,您应该通过手动启动yourscript来测试它,然后再将它定期运行。您可能会发现wget不够强大,无法做您想做的事情,特别是在需要用户交互的网页上。
https://askubuntu.com/questions/266387
复制相似问题