python - working with crontab -
i'm new python. googling has got me module https://pypi.python.org/pypi/python-crontab. i've setup env , installed python-crontab==1.9.3. keep getting errors. doing wrong? appreciate. i'm trying use examples don't seem working me.
what following:
- add cron job cron tab
terminal error output:
traceback (most recent call last): file "test5.py", line 5, in <module> users_cron = crontab(user='testuser') file "/users/testuser/desktop/sample1/prj-env/lib/python2.7/site-packages/crontab.py", line 187, in __init__ self.read(tabfile) file "/users/testuser/desktop/sample1/prj-env/lib/python2.7/site-packages/crontab.py", line 231, in read raise ioerror("read crontab %s: %s" % (self.user, err)) ioerror: read crontab testuser: crontab: must privileged use -u
users_cron = crontab(user='testuser')
it appears trying create cronjob user 'testuser'.
ioerror: read crontab testuser: crontab: must privileged use -u
the error telling you need privileged user able that. try running script 'sudo':
sudo python my_python_script.py
Comments
Post a Comment