jotta / jotta-cli-issues

45 stars 1 forks source link

How to configure jottad to listen on TCP socket instead of UNIX socket so cron jobs work again #162

Closed ghost closed 2 years ago

ghost commented 2 years ago

Make sure you are running the latest version of jotta-cli before reporting an issue.

jotta-cli release (jotta-cli version): 0.12.50392

Description of problem: After the latest update, I have jottad running under a regular user account. I however have some cron scripts that access jotta-cli (printing status etc). Even when I sudo or su from root to this regular user, jotta-cli cannot connect to the jottad instance. I think the quickest solution would be to start listening again on a TCP socket like it used to. The only problem is I cannot find any documentation how to configure this mode. Could you add some? Thank you very much in advance :)

Expected:

I would expect some documentation on how to configure TCP listen IP and socket number.

Kimbsen commented 2 years ago

jottad and jotta-cli now look for XDG_RUNTIME_DIR where it stores the socket file.

XDG_RUNTIME_DIR is not set by bash and su and or sudo does not create it. For security reasons it's only managed by systemd at session login for the user

I think something like this might work in your case:

su --login $user -c "XDG_RUNTIME_DIR=/run/user/$(id -u $user) jotta-cli status"
ghost commented 2 years ago

Thank you so much for the quick response, your solution indeed works fine! 😄