简体   繁体   English

Linux“at”任务调度程序是否有python模块

[英]Is there a python module for the Linux "at" task scheduler

Lest I reinvent the wheel .... again:免得我重新发明轮子......再次:

Is there a python interface, API or module for the standard linux "at" task scheduler?是否有用于标准 linux“at”任务调度程序的 python 接口、API 或模块? I have tried searching the internet but searching for the word "at" is a tad bit useless :-)我试过在互联网上搜索,但搜索“at”这个词有点没用:-)

My intention is to have a python script process same data and construct a shell file.我的目的是让 python 脚本处理相同的数据并构建一个 shell 文件。 Then use a subprocess call to have "at" schedule the job file for a specific date and time.然后使用子进程调用让“at”安排特定日期和时间的作业文件。 I will have a similar function using "Schtasks.exe" if python detects it is running on windows.如果python检测到它正在Windows上运行,我将使用“Schtasks.exe”获得类似的功能。 Lastly the python script exits ... leaving system scheduler the responsibility of running the job file.最后python脚本退出......让系统调度程序负责运行作业文件。

update 1 July 2019: Found an interesting "at" quirk. 2019 年 7 月 1 日更新:发现了一个有趣的“at”怪癖。 The file called on the "at" command line ( ie the script or shell file ) does not need to be marked as "executable" in order to be run by "at".在“at”命令行上调用的文件(即脚本或shell文件)不需要标记为“可执行”才能由“at”运行。

For the record: I am running Linux Mint 19.1为了记录:我正在运行 Linux Mint 19.1

You can achieve this with different approach:您可以使用不同的方法来实现这一点:

  • Write your python script.编写你的python脚本。
  • Call this script with a bash file.使用 bash 文件调用此脚本。
  • Schedule bash file with a crontab task.使用 crontab 任务安排 bash 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM