Tuesday, July 16, 2013

Python Crontab Simple usage

pip install python-dateutil python-crontab

from crontab import CronTab
user_cron = CronTab('myuser')
command = "/usr/bin/ls -la"
comment = "Run"
job = user_cron.new(command=command, comment=comment)
job.minute.every(5)
job.is_valid()
user_cron.write("outfile.tab")

No comments: