Skip to main content
Skip table of contents

Changing Contents in a File in Every Node

Occasionally you may want to change a a single string inside of a file that is on every compute node. If the file was the same on every node you could change it in one place and then copy it out like so:

CODE
$ act_cp -g nodes /path/to/file

Some config files are unique to each node, but may have a recurring string that you want to change on each one of them. In the following example we will use the ‘act_exec’ command paired with a simple ‘sed’ search and replace command in order to change an IP address.

CODE
$ act_exec -g nodes "sed -i 's/10.1.1.254/10.1.1.250/' /etc/sysconfig/network-scripts/ifcfg-eth0"

In the above example I already know that each one of my nodes ifcfg-eth0 files has a gateway of 10.1.1.254 set, and I want to change this to 10.1.1.250 for every one of my nodes. This is an easy way to accomplish simple replacements across your entire cluster.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.