Linux下如何在特定时间运行脚本? [英] Linux How to run script at certain time?

查看:94
本文介绍了Linux下如何在特定时间运行脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含特定的日期和时间的文本文件。
我希望能够为运行在该文件中指定的时间的脚本。
你将如何做到这一点?
创建一个在后台运行(按A守护进程),并检查每一秒,如果当前时间相匹配的文件中的时间的另一个脚本?
有另一种方式?
本机是一种的Linux 服务器,喘Debian的。
在此先感谢

I have a text file containing a specific date and time. I want to be able to run a script at the time specified in that file. How would you achieve that? Create another script that runs in background (sort of a deamon) and checks every second if the current time is matching the time in the file? Is there another way? The machine is a linux server , Debian wheezy. Thanks in advance

推荐答案

请看以下内容:

echo "ls -l" | at 07:00

这code线执行ls -l命令在特定的时间。这是执行在特定时间的东西(在我的例子的命令)的一个例子。 AT是你真正要找的命令。你可以在这里阅读说明:

This code line executes "ls -l" at a specific time. This is an example of executing something (a command in my example) at a specific time. "at" is the command you were really looking for. You can read the specifications here:

<一个href=\"http://manpages.ubuntu.com/manpages/hardy/man1/at.1posix.html\">http://manpages.ubuntu.com/manpages/hardy/man1/at.1posix.html

希望它帮助!

这篇关于Linux下如何在特定时间运行脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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