Ok, I have found a solution to this, but it looks a little ugly, so i thought id see if you guys can come up with something more elegant.
Im creating a first boot script resource for use with NIM automated installs. I want the fb_script to do lots of things, but the part i have been puzzling with is how to get it to edit the /etc/rc.tcpip file on the newly installed AIX server.
For example, xntpd is by default disabled in /etc/rc.tcpip, and i want the fb_script to enable it by removing the leading #.
My 1st thought was to use sed, and i come up with this, which does work, but looks pretty ugly.
A colleague came up with something a little shorter.
Im sure there are a million ways this can be done, so I thought id open this up for discussion.
Im creating a first boot script resource for use with NIM automated installs. I want the fb_script to do lots of things, but the part i have been puzzling with is how to get it to edit the /etc/rc.tcpip file on the newly installed AIX server.
For example, xntpd is by default disabled in /etc/rc.tcpip, and i want the fb_script to enable it by removing the leading #.
Code:
# Start up Network Time Protocol (NTP) daemon
#start /usr/sbin/xntpd "$src_running"
My 1st thought was to use sed, and i come up with this, which does work, but looks pretty ugly.
Code:
sed '/xntpd/s/^\#start \/usr\/sbin\/xntpd \"\$src_running\"/start \/usr\/sbin\/xntpd \"\$src_running\"/' /etc/rc.tcpip
A colleague came up with something a little shorter.
Code:
cat /etc/rc.tcpip | sed "s/#\(start.*xntpd.*\)/\1/" | grep xntpd
Im sure there are a million ways this can be done, so I thought id open this up for discussion.