I have 100+ Linux Server in which I need to add local Server FQDN , Hostname and IP Address of RHEL node into their /etc/hosts file.
Can anyone please guide what would be the best way to achieve it via BigFix Action Script.
If your just trying to append a line to the end of an existing file I usually use echo “text” >> (file). Replacing specific lines in a file can get a little more complex.
Yes, that’s correct… I am trying to append a line to the end of the file.
My query is I have 100+ Linux Server on which I want to append its own DNS Name, HostName and IP address at the last line of Hostfile. How this can be done?
For Example
If I execute Action Script on X,Y,Z Server and then action script should automatically append in last line as
On X Server
HostName :- X DNS Name :- X.xyzcompany.com IPaddress :- X.X.X.X
On Y Server
HostName :- Y DNS Name :- Y.xyzcompany.com IPaddress :- Y.Y.Y.Y
On Z Server
HostName :- Z DNS Name :- Z.xyxcompany.com IPaddress:- Z.Z.Z.Z
just create shell script and call that script to modify the content of /etc/hosts. from the shell script you will have better control over the editing. you can take the backup of existing host and update it.