systemd.network(5) get a value from file, or environment?systemd: default value for environment variableHow...
With a data transfer of 50 GB estimated 5 hours, are USB-C claimed speeds inaccurate or to blame?
How do I separate enchants from items?
What does "spinning upon the shoals" mean?
Clarinets in the Rite of Spring
Is it ok for parents to kiss and romance with each other while their 2- to 8-year-old child watches?
Can one block with a protection from color creature?
US citizen traveling with Peruvian passport
What is the relationship between external and internal composition in a cartesian closed category?
Wires do not connect in Circuitikz
Why did Robert F. Kennedy loathe Lyndon B. Johnson?
What was the nature of the known bugs in the Space Shuttle software?
Why is a mixture of two normally distributed variables only bimodal if their means differ by at least two times the common standard deviation?
Strong Password Detection in Python
Moving millions of files to a different directory with specfic name patterns
Why did Old English lose both thorn and eth?
stuck {in/at} beta
Is this really the Saturn V computer only, or are there other systems here as well?
Was it ever illegal to name a pig "Napoleon" in France?
Can "expliquer" be followed by "que" and the subjunctive?
Computer name naming convention for security
QR codes, do people use them?
Intern not wearing safety equipment; how could I have handled this differently?
How do resistors generate different heat if we make the current fixed and changed the voltage and resistance? Notice the flow of charge is constant
Can you create a free-floating MASYU puzzle?
systemd.network(5) get a value from file, or environment?
systemd: default value for environment variableHow can I make my user services wait till the network is online?Set environment variable for all services running under systemdDynamic variables in systemd service unit filesPrevent a system service from starting of another specified unit is activePass an environment variable from current shell to a systemd unitHow does systemd stop services that don't have a unit filePassing environment variables around in systemdIs it possible to have a drop-in file for templates?How to protect an EnvironmentFile used by a systemd service?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I know that *.service units support Environment=key=val and EnvironmentFile=fname entries, but it appears that *.network files don't.
Is there any other way of getting, the value of an Address specifically, in from a different file or environment variable?
e.g. the result would be like:
# /etc/some/conf
192.0.2.3
# some.network
[Match]
Name=some
[Network]
# (! invalid !) example of desired effect
Address=$(cat /etc/some/conf)
systemd systemd-networkd
add a comment |
I know that *.service units support Environment=key=val and EnvironmentFile=fname entries, but it appears that *.network files don't.
Is there any other way of getting, the value of an Address specifically, in from a different file or environment variable?
e.g. the result would be like:
# /etc/some/conf
192.0.2.3
# some.network
[Match]
Name=some
[Network]
# (! invalid !) example of desired effect
Address=$(cat /etc/some/conf)
systemd systemd-networkd
add a comment |
I know that *.service units support Environment=key=val and EnvironmentFile=fname entries, but it appears that *.network files don't.
Is there any other way of getting, the value of an Address specifically, in from a different file or environment variable?
e.g. the result would be like:
# /etc/some/conf
192.0.2.3
# some.network
[Match]
Name=some
[Network]
# (! invalid !) example of desired effect
Address=$(cat /etc/some/conf)
systemd systemd-networkd
I know that *.service units support Environment=key=val and EnvironmentFile=fname entries, but it appears that *.network files don't.
Is there any other way of getting, the value of an Address specifically, in from a different file or environment variable?
e.g. the result would be like:
# /etc/some/conf
192.0.2.3
# some.network
[Match]
Name=some
[Network]
# (! invalid !) example of desired effect
Address=$(cat /etc/some/conf)
systemd systemd-networkd
systemd systemd-networkd
edited 11 mins ago
OJFord
asked 42 mins ago
OJFordOJFord
6611 gold badge6 silver badges16 bronze badges
6611 gold badge6 silver badges16 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
From systemd.network man:
The
.networkfiles are read from the files located in the system
network directories/usr/lib/systemd/networkand
/usr/local/lib/systemd/network, the volatile runtime network directory
/run/systemd/networkand the local administration network directory
/etc/systemd/network. All configuration files are collectively sorted
and processed in lexical order, regardless of the directories in which
they live. However, files with identical filenames replace each other.
Files in/etchave the highest priority, files in/runtake precedence
over files with the same name under/usr. This can be used to override
a system-supplied configuration file with a local file if needed. As a
special case, an empty file (file size 0) or symlink with the same
name pointing to/dev/nulldisables the configuration file entirely
(it is "masked").
[...]
An "
[Address]" section accepts the following keys. Specify several
"[Address]" sections to configure several addresses.
Sorry, I think I might not have been clear: I know I can put several.networkfiles in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.
– OJFord
15 mins ago
what about theAddresssection I've mentioned? according to man, you can specify many IP addresses there..
– Bart
10 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f528738%2fsystemd-network5-get-a-value-from-file-or-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
From systemd.network man:
The
.networkfiles are read from the files located in the system
network directories/usr/lib/systemd/networkand
/usr/local/lib/systemd/network, the volatile runtime network directory
/run/systemd/networkand the local administration network directory
/etc/systemd/network. All configuration files are collectively sorted
and processed in lexical order, regardless of the directories in which
they live. However, files with identical filenames replace each other.
Files in/etchave the highest priority, files in/runtake precedence
over files with the same name under/usr. This can be used to override
a system-supplied configuration file with a local file if needed. As a
special case, an empty file (file size 0) or symlink with the same
name pointing to/dev/nulldisables the configuration file entirely
(it is "masked").
[...]
An "
[Address]" section accepts the following keys. Specify several
"[Address]" sections to configure several addresses.
Sorry, I think I might not have been clear: I know I can put several.networkfiles in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.
– OJFord
15 mins ago
what about theAddresssection I've mentioned? according to man, you can specify many IP addresses there..
– Bart
10 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
add a comment |
From systemd.network man:
The
.networkfiles are read from the files located in the system
network directories/usr/lib/systemd/networkand
/usr/local/lib/systemd/network, the volatile runtime network directory
/run/systemd/networkand the local administration network directory
/etc/systemd/network. All configuration files are collectively sorted
and processed in lexical order, regardless of the directories in which
they live. However, files with identical filenames replace each other.
Files in/etchave the highest priority, files in/runtake precedence
over files with the same name under/usr. This can be used to override
a system-supplied configuration file with a local file if needed. As a
special case, an empty file (file size 0) or symlink with the same
name pointing to/dev/nulldisables the configuration file entirely
(it is "masked").
[...]
An "
[Address]" section accepts the following keys. Specify several
"[Address]" sections to configure several addresses.
Sorry, I think I might not have been clear: I know I can put several.networkfiles in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.
– OJFord
15 mins ago
what about theAddresssection I've mentioned? according to man, you can specify many IP addresses there..
– Bart
10 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
add a comment |
From systemd.network man:
The
.networkfiles are read from the files located in the system
network directories/usr/lib/systemd/networkand
/usr/local/lib/systemd/network, the volatile runtime network directory
/run/systemd/networkand the local administration network directory
/etc/systemd/network. All configuration files are collectively sorted
and processed in lexical order, regardless of the directories in which
they live. However, files with identical filenames replace each other.
Files in/etchave the highest priority, files in/runtake precedence
over files with the same name under/usr. This can be used to override
a system-supplied configuration file with a local file if needed. As a
special case, an empty file (file size 0) or symlink with the same
name pointing to/dev/nulldisables the configuration file entirely
(it is "masked").
[...]
An "
[Address]" section accepts the following keys. Specify several
"[Address]" sections to configure several addresses.
From systemd.network man:
The
.networkfiles are read from the files located in the system
network directories/usr/lib/systemd/networkand
/usr/local/lib/systemd/network, the volatile runtime network directory
/run/systemd/networkand the local administration network directory
/etc/systemd/network. All configuration files are collectively sorted
and processed in lexical order, regardless of the directories in which
they live. However, files with identical filenames replace each other.
Files in/etchave the highest priority, files in/runtake precedence
over files with the same name under/usr. This can be used to override
a system-supplied configuration file with a local file if needed. As a
special case, an empty file (file size 0) or symlink with the same
name pointing to/dev/nulldisables the configuration file entirely
(it is "masked").
[...]
An "
[Address]" section accepts the following keys. Specify several
"[Address]" sections to configure several addresses.
answered 31 mins ago
BartBart
5261 silver badge14 bronze badges
5261 silver badge14 bronze badges
Sorry, I think I might not have been clear: I know I can put several.networkfiles in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.
– OJFord
15 mins ago
what about theAddresssection I've mentioned? according to man, you can specify many IP addresses there..
– Bart
10 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
add a comment |
Sorry, I think I might not have been clear: I know I can put several.networkfiles in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.
– OJFord
15 mins ago
what about theAddresssection I've mentioned? according to man, you can specify many IP addresses there..
– Bart
10 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
Sorry, I think I might not have been clear: I know I can put several
.network files in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.– OJFord
15 mins ago
Sorry, I think I might not have been clear: I know I can put several
.network files in multiple locations, but I want just one, that loads its address from either a file that contains only an IP address (no knowledge that it's going into a systemd file), or an env var. I've edited OP to make that clearer.– OJFord
15 mins ago
what about the
Address section I've mentioned? according to man, you can specify many IP addresses there..– Bart
10 mins ago
what about the
Address section I've mentioned? according to man, you can specify many IP addresses there..– Bart
10 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
@OJFord , an example of such configuration here: superuser.com/a/775900/1049376
– Bart
7 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
I'm not looking to specify many, just to specify one that's defined elsewhere.
– OJFord
2 mins ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f528738%2fsystemd-network5-get-a-value-from-file-or-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown