Search code examples
pythoncronpackageexecuteat-job

How to use at command to set python script execute at specified time


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

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


Solution

  • Just do

    python FILE | at TIME > app.log
    

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

    TIME - Your time