Bash: text processing and scripts / Stage 2 of 9 · step 8 of 9
Change an address in every config
Not running
Starting
Situation
The store runs thirty instances of its application, each with its own settings file in
/etc/app.d/ — lines of the form key=value. The orders backend has moved: it was
10.20.0.15:8080, now it is 10.20.0.40:8080. The old server goes off tonight, and by then the
instances that talk to it must talk to the new one. The key holding the backend address is
upstream.
Different people have edited these configs by hand for years.
Task
Make sure that in every /etc/app.d/*.conf:
- each
upstreamline that pointed to10.20.0.15:8080points to10.20.0.40:8080; - the comments stay as they were, including commented-out settings: your colleagues read the history from them;
- the other lines don't change — other keys and the
upstreamlines that point to other addresses.
There is no need to restart the application, it rereads its settings by itself. Editing thirty
files by hand takes long — edit them as a stream, but first look at how upstream is written in
different files.
Lab goals
0 of 3-
In every /etc/app.d/*.conf the upstream lines that pointed to 10.20.0.15:8080 point to 10.20.0.40:8080 — not checked yet
-
The comments and commented-out settings are as they were — not checked yet
-
The other lines are as they were, including upstream lines with other addresses — not checked yet
Hints
0 of 3 open · they open one at a time
Hint 1
Show the solution
after 3 failed checks