Comments (7)
by the way, how to push the directory value as configuration item to the started service? Is there any documentation that %t relates to a standard system configuration value / environment variable? Everybody knows $HOME but what about this one?
from docker-systemctl-replacement.
"%t" | Runtime directory root | This is either /run (for the system manager) or the path "$XDG_RUNTIME_DIR" resolves to (for user managers). |
---|
From this page: systemd.unit
Lots of other % specifiers as well, all listed in a nice table on that page.
from docker-systemctl-replacement.
While checking I had notice that the path itself was wrong ... instead of /run it was targetting /var.
I don't know if that is a good idea as /run may possibly not be present in docker containers.
Another thing is that I have implemented user_mode for the environment variables as well, but the systemd documention is incomplete (again). It just says to use the XDG variables but if you look into that freedesktop standard then applications are asked to assume default values for XDG variables when they are not present. So in user mode, shall systemctl.py fallback to the systemd's system-level values or to freedesktop's user-level values. Hmm.
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
from docker-systemctl-replacement.
Containers based on centos, at least, have /var/run -> /run, so either would work. I think most versions of Unix have an equivalent. The only problem is if neither one is there.
To start, I would look for /run. If it exists, use it. If not, look for /var/run. If it exists, use it. If neither one exists... ???
That page seems fairly clear as to how to handle things if the XDG variables are not set, such as
"If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used."
There is a phrase like this for each of the variables, stating the default location if the variable isn't set.
I would implement user_mode values based on that page, and cite the link for people to look up the details.
Making your code work to the freedesktop standards is not a bad thing. :-)
from docker-systemctl-replacement.
Well, I know the freedesktop standard but I am unsure if those defaults apply to user-mode of systemctl.py. The systemd's documentation may be read as "if $XDG_xy does exist".
On a second thought I do basically have to make a differentiation here for user-mode. In USERMODE.md I do describe that system-services may also be run in user containers, and the env-vars is a place where I do simply have to check whether the target service as originally meant to be a system-service or user-service. That's the point I was missing here as in the later case it makes fully sense to use XDG defaults and not system defaults.
from docker-systemctl-replacement.
Done the implementation. The test_3260 does also show that %t is expanded differently for --user mode. The %t had been already part of test_3250 for --system mode, with the value corrected.
Please confirm that this fixes your request. :)
from docker-systemctl-replacement.
So far my tests seem to be okay, so I'll keep it that way for the upcoming release 1.4
from docker-systemctl-replacement.
Related Issues (20)
- Version tag 1.5.1706 HOT 1
- 'systemctl' not working HOT 16
- Starting a service during image build / docker file, hangs HOT 7
- Possible to work with ansible service_facts module? HOT 1
- systemctl3.py not working on Rocky Linux 8 HOT 1
- Misleading error message interaction between ExecStart= and ExecStartPost= HOT 3
- systemctl enable doesn't copy service file to right place. HOT 1
- When control-C on systemctl log -f xxx, it raise an ugly KeyboardInterrupt HOT 2
- systemctl disable not disabling service at container restart HOT 1
- can this script be used on ubuntu 22.04? HOT 1
- How is this suppoused to be ussed? HOT 1
- ERROR:systemctl: nextcloud.service: Failed to parse service type, ignoring: exec HOT 1
- Install to Centos6.8 HOT 1
- StartLimitIntervalSec=0 or how to Restart Forever HOT 1
- status command shows unit files ignored by SystemD HOT 2
- systemctl show does not respect multiple `-p/--property` switches HOT 1
- BlockingIOError: [Errno 11] Resource temporarily unavailable HOT 11
- Can't understand how logs and tty are working
- Support for systemd-inhibit? HOT 1
- systemctl start virtstoraged.service Startup exception HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-systemctl-replacement.