gilesknap / gphotos-sync

Google Photos and Albums backup with Google Photos Library API
Apache License 2.0
1.97k stars 163 forks source link

Initiate automated pipenv from crontab? [Linux] #328

Closed bamsnow closed 2 years ago

bamsnow commented 2 years ago

Does anyone know a working way to initiate gphoto-sync in linux via crontab. I have tried many iterations of something like this:

in /etc/crontab

1,30 USERNAME cd /home/USERNAME && /usr/local/bin/pipenv run ./gphotos-sync --db-path /home/USERNAME/gphoto_db --logfile /tmp /home/USERNAME/gphoto_local/gphoto 2>&1

...but I cannot get it to work.

Running the following from the command line works fine:

pipenv run gphotos-sync --db-path ~/gphoto_db --logfile /tmp ~/gphoto_local/gphoto

The idea is to run it every 30 mins. Any help?

gilesknap commented 2 years ago

I'm not sure why your approach does not work. However I have a script that does the cd and then invokes pipenv (annoying feature of pipenv is that it only works off of cwd). Then call that script from crontab.

This keeps the crontab entry very simple.

gilesknap commented 2 years ago

I think this is resolved? closing.