0

Unable to find 'crontab -l -u user' equivalent in python

I would like to write a python script for listing all user crons. Installed python-crontab module but unable to find crontab -l -u user' equivalent

1st Mar 2017, 12:27 PM
chiju
chiju - avatar
2 Réponses
+ 1
As far as I understand, this is how you do it: from crontab import CronTab cr = CronTab(user="username") # Then simply iterate over cr for cron_event in cr: # do whatever
2nd Mar 2017, 2:27 PM
DefaltSimon
DefaltSimon - avatar
0
thanks man
2nd Mar 2017, 4:13 PM
chiju
chiju - avatar