3 ms·
For what it's worth this will not work properly, you have different environment variables for user and system units. Proper error handling and graceful fallback
by c0balt 1y ago
For what it's worth this will not work properly, you have different environment variables for user and system units. Proper error handling and graceful fallback for these cases are probably worth a module here (though it could be a 10-20 liner instead too).
- TheDong 1y ago> you have different environment variables for user and system units Really? I thought the point of the environment variable was it was the same, and the directory it pointed to differed depending on the service type. I'd love a reference since at least for every systemd version I've used, you're wrong. > Proper error handling and graceful fallback That's application specific, so it can't really fit in a generic library well.
- c0balt 1y ago> I'd love a reference since at least for every systemd version I've used, you're wrong. I must've had it confused with StateDirectory[0]. Thank you for pointing my mistake out. That does make the library a bit less useful. [0]: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html https://www.freedesktop.org/software/systemd/man/latest/syst... Table 2
- TheDong 1y agoStateDirectory looks like it's also always the environment variable 'STATE_DIRECTORY', regardless whether it's a user or system unit, right? systemd-run -p StateDirectory=test -t sh -c 'echo $STATE_DIRECTORY' works fine with both `--system` and `--user`, so seems like that's the same too.