Linux Labs

Bash: text processing and scripts / Stage 2 of 9 · step 8 of 9

Change an address in every config

medium ~25 min
Not running Starting usually ~20 s
Report a problem

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:

  1. each upstream line that pointed to 10.20.0.15:8080 points to 10.20.0.40:8080;
  2. the comments stay as they were, including commented-out settings: your colleagues read the history from them;
  3. the other lines don't change — other keys and the upstream lines 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.

Visible only to you. Saved as you type.

All notes

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

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…