iwonbigbro/gsync

error with cron

epicbastion opened this issue · 0 comments

ok so I can run this shell file from a console with sudo just fine but when i put it in a cron.d file and try and get it to run it as root it gives me this. What am I doing wrong or how can i fix this so it will run.

Subject: Cron root@littlebigservers /data/sh/gsync.sh
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

DEBUG: ENoTTY(): File "/usr/local/bin/gsync", line 55, in
crawler = Crawler(p, dest)
File "/usr/local/lib/python2.7/dist-packages/libgsync/crawler.py", line 57, in init
info = self._drive.stat(self._dst)
File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/init.py", line 507, in stat
ents = self._query(parentId = parentId)
File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/init.py", line 767, in _query
service = self.service()
File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/init.py", line 231, in service
credentials = self._obtainCredentials()
File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/init.py", line 328, in _obtainCredentials
raise ENoTTY

Error:

EDIT: So for the rest of us who do not know what this error is, if you set up your credentials from your normal sudo user and then try to run this as root from cron it gives you this error. You have to run the script or the command from root not sudo but actual root to get credentials from google drive for your root account in order for this to run. Not sure how folks who do not use root are expected to be able to get this to run in a cron job, but I actually go against the ubuntu code and use root so this is kind of solved for me but anyone who follows the proscribed methods may not be able to get gsync to run in cron.