OK, so I have been trying to get this to work for about a week and a half now. I have read countless threads from an endless supply of forums and FAQ pages, and the bottom line is I cannot find the "right" answer.
I apologize in advance if seems like a Noob question or the answer is truely out there some place, but I am looking for simpleton terms on how to do this.
In a nutshell:
- We do 2 flavors of install distro's where I am working, RHEL & CentOS (both 32 & 64 bit).
- We use a kickstart.pl script to generate the ks.cfg for each installation.
- The kickstart is used to collect hostname, ISO image, IP Address, lan or dmz, plus whether or not to download a particular version of Tomcat & JDK.
- Within the kickstart a handful of files are copied from a management server (also the kickstart server) via FTP to the server being built.
- Then a Bash Shell script is called and executed.
What the Bash script does:
- Runs /sbin/chkconfig to turn various services & daemons off.
- Sets the runlevel.
- Moves files for sshd, snmp and configures them to run.
- Adds a couple of symbolic links.
- Sets the timezone.
Heres the problem:
There is an "if - then - else" statement in the called-up script;
# - put syslog and yum configurations in place
/bin/mv /etc/syslog.conf /etc/syslog.conf.${THEDATE}
/bin/mv /etc/yum.conf /etc/yum.conf.${THEDATE}
# determine if LAN ( xxx.lan.int ) or DMZ ( xxx-dmz.ext )
hostname -f | grep -q xxx.lan.int; RC=$? ;
if [ $RC -eq 0 ]
then
/bin/cp /root/WORK/finish/syslog.lan.conf /etc/syslog.conf
/bin/cp /root/WORK/finish/yum.lan.conf /etc/yum.conf
else
/bin/cp /root/WORK/finish/syslog.dmz.conf /etc/syslog.conf
/bin/cp /root/WORK/finish/yum.dmz.conf /etc/yum.conf
fi
Because the new system is still running in "kickstart" mode when it gets to this part of the script the "hostname-f" will always fail and default to the "else" part of the statement, which works great for DMZ builds.
If I break this piece of code out as it's own script and have it copied to the system with the other files from the management/kickstart server, reboot, chmod the file to 755 and then run the script ./scriptname.sh manually it works 100% everytime.
My question(s):
How do I run this break-out script only once after the kickstart finishes? I have seen numerous posts on copying the script to /etc/init.d/ and create a symbolic link to the script. I have also seen copy it to /etc/rc#.d/init.d/ (where #=boot priority) and again create a symbolic link to it. Where is the "symbolic link" created? In the kickstart? In the bash script? How do you determine the correct boot priority? Does boot priority even matter?
Is there a better way to write this "if" statement in the initial setup script?
Can the hostname be forced to be set in the kickstart or script, to allow the hostname -f command to work?
I don't consider myself a complete Noob, but I am by no means an expert, so again apologize if this is the wrong place to be asking these questions. Oh, and yes all of the builds are server, not workstation.
To answer another question some of you may ask, the sys engineer does not want to only one syslog server for both DMZ and LAN, he would like to keep firewall traffic to specific ports for the server applications and avoid the unnecessary syslog traffic going across the firewall.
Thank you in advance for any help and sugesstions,