This page gives a good introduction to Plan. If you do not have Plan installed, check out Installation section.
A simple usage looks like this:
from plan import Plan
cron = Plan()
cron.command('ls /tmp', every='1.day', at='12:00')
cron.command('pwd', every='2.month')
cron.command('date', every='weekend')
if __name__ == "__main__":
cron.run()
Just save it as schedule.py (or whatever you want) and run it with your Python interpreter. Make sure to not name it plan.py becaure it would conflict with Plan itself.
Now we do not run with one explicit run_type, default run_type check will be used, you should see your cron syntax jobs in the output of terminal:
# Begin Plan generated jobs for: main
0 12 * * * ls /tmp
0 0 1 1,3,5,7,9,11 * pwd
0 0 * * 6,0 date
# End Plan generated jobs for: main
So what did the above code do?
或是邮件反馈可也:
askdama[AT]googlegroups.com
订阅 substack 体验古早写作:
关注公众号, 持续获得相关各种嗯哼: