sourcegraph/thyme

Thyme on crontab?

teppov opened this issue · 2 comments

It may well be that I haven't quite understood how you are supposed to automate running Thyme. On Debian, I have tried to make Thyme run every minute with crontab:

* * * * * ~/Code/Go/bin/thyme track -o ~/Thyme/thyme_track.json

If I run the above command (without the crontab asterisks, of course) on shell, it creates the json as expected. In addition, if I check the syslog, I can see that cron seems to have executed the command:

Dec 16 21:32:01 debian CRON[5043]: (username) CMD (~/Code/Go/bin/thyme track -o ~/Thyme/thyme_track.json)

However, the crontab scheduling of thyme track does not create (nor update) the json. Other crontab schedulings do work, for example:

* * * * * touch ~/Thyme/touched.file

Have I missed something?

Thanks for help already in advance!

Just found this - FWIW, here's what I do:

* * * * * DISPLAY=:0 thyme track -o /home/florian/.local/share/thyme.json

You might need to set DISPLAY as well, as it's probably not set in cron's environment. Also, I'm not sure whether ~ works there.

You might need the DISPLAY and DBUS_SESSION_BUS_ADDRESS environment variables.
To test cron jobs from the console, see https://stackoverflow.com/a/2546509