I use following code to schedule a task, but the Crontab entry it produces is in wrong format.
def main():
from crontab import CronTab
cron = CronTab(user=True)
job = cron.new(command='python /home/niroshan/repos/maisie/Tests/dummyprint.py')
job.minute.on(2)
cron.write()
When I execute crontab -e
I can see following crontab entry, but the script does not get called.
2 * * * * python /home/niroshan/repos/maisie/Tests/dummyprint.py
After some googling I manually changed the entry to look like below and it started working.
*/2 * * * * python /home/niroshan/repos/maisie/Tests/dummyprint.py
How do I get python to create the entry in correct format?