如何使用at命令设置python脚本在指定时间执行 [英] How to use at command to set python script execute at specified time

查看:162
本文介绍了如何使用at命令设置python脚本在指定时间执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我以后尝试使用cron执行我的python脚本时,我发现AFAIK处有一个命令,cron用于定期执行,但是我的方案在指定的时间内只能执行一次.我的问题是如何在命令中添加python脚本,还有一些用于控制at命令的python包

When I try to use cron to execute my python script in a future time, I found there is a command at, AFAIK, the cron is for periodically execute, but what my scenario is only execute for once in specified time. and my question is how to add python script to at command, also it there some python package for control the at command

我的开发人员是ubuntu 10.04 lucid版本,我的产品服务器是ubuntu-server 10.04 lucid版本.实际上,我想通过python脚本将python脚本任务添加到at命令中,该文件的更改可以在命令添加或删除新作业时生效

My dev os is ubuntu 10.04 lucid,and my product server is ubuntu-server 10.04 lucid version. in fact, I want through python script add python script tasks to at command, which file's change can effect at command add or remove new jobs

推荐答案

只需

python FILE | at TIME > app.log

替换:FILE-您的.py文件(包括shebang)

replace: FILE - Your .py file (include the shebang)

时间-您的时间

这篇关于如何使用at命令设置python脚本在指定时间执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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