View Single Post
Old 05-05-2017, 12:15 PM   #8
paperrhino
Junior Member
paperrhino began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Apr 2017
Device: Android
Quote:
This is probably stating the obvious, but it's ridiculously easy to set a bunch of env vars, and then put yourself outside the context you've set them in. Like logging in as another user who doesn't have it set in the first place, su'ing without the -, or forgetting to export the vars in a script.
Indeed but as part of my debugging I've echoed the environment variable immediately before running calibredb to verify that the variable is set.

Quote:
Since it's headless, you're remote logging in, and I assume not directly as the user the service is running as.
That is correct, however, I have also tried it running as the calibre user using:

sudo -u calibre
su - calibre
sudo -u calibre /bin/bash

In each case I've verified that the environment variable is set before running calibredb.

Quote:
Does wrapping calibredb in say, a calibredb-wrapper script that does nothing but set and export the vars you need, and runs calibredb work?
I've done this as well.

In every case, rather than using the metadada.db file that is in /home/calibre and defined in the environment variable it creates a new one in /mnt/books/library.

Has anyone else actually done this? It seems unlikely that I'm the first person to try. Either calibredb doesn't pay attention to the environment variable or I'm doing something stupid.
paperrhino is offline   Reply With Quote