We intend to write multiple scripts in the %pre and %post section of the kickstart files as per our requirement but since these scripts are executed in the background it is very important that we perform proper logging of individual section so that once the node is successfully installed those logs can be validated to make sure all the scripts were successfully executed and to debug further in case of failure.
Since %post section is by default executed in chroot environment write an additional %post script as below to save both your %pre log files we used above
So once your node is successfully installed check "/var/log" for your both the kickstart_pre*.log files and the %post section log files
I hope the article was helpful.
How to configure a Clustered Samba share using ctdb in Red Hat Cluster
How to delete an iscsi-target from openfiler and Linux
How to perform a local ssh port forwarding in Linux
How to use yum locally without internet connection using cache?
What is umask and how to change the default value permanently?
Understanding Partition Scheme MBR vs GPT
How does a successful or failed login process works in Linux
How to find all the process accessing a file in Linux
How to exclude multiple directories from du command in Linux
How to configure autofs in Linux and what are its advantages?
How to resize software raid partition in Linux
How to configure Software RAID 1 mirroring in Linux
How to prevent a command from getting stored in history in Linux
How to enable logging of %pre and %post scripts in kickstart?
Below syntax can be used to enable the logging of individual %pre and %post section in a kickstart file%pre --log=/var/log/kickstart_pre1.log
echo "Hello World"
echo "This is first pre-installation script"
%end
%pre --log=/var/log/kickstart_pre2.log
echo "Hello World"
echo "This is second pre-installation script"
%end
%post --log=/var/log/kickstart_post1.log
echo "Hello World"
echo "This is first post-installation script"
%end
%post --log=/var/log/kickstart_post1.log
echo "Hello World"
echo "This is second post-installation script"
%end
How to store %pre section logs to be accessible after complete Red Hat Installation?
Now this is the tricky part as all the logs stores for %post section would be accessible after a node is successfully installed but we have to take some extra steps to save the %pre script log filesSince %post section is by default executed in chroot environment write an additional %post script as below to save both your %pre log files we used above
%post --log=/var/log/kickstart_post_3.log--nochroot
echo "Copying %pre installation script log files
/bin/cp -rvf /var/log/kickstart_pre*.log /mnt/sysimage/var/log/
%end
So once your node is successfully installed check "/var/log" for your both the kickstart_pre*.log files and the %post section log files
I hope the article was helpful.
Follow the below links for more tutorials
How to find the path of any command in LinuxHow to configure a Clustered Samba share using ctdb in Red Hat Cluster
How to delete an iscsi-target from openfiler and Linux
How to perform a local ssh port forwarding in Linux
How to use yum locally without internet connection using cache?
What is umask and how to change the default value permanently?
Understanding Partition Scheme MBR vs GPT
How does a successful or failed login process works in Linux
How to find all the process accessing a file in Linux
How to exclude multiple directories from du command in Linux
How to configure autofs in Linux and what are its advantages?
How to resize software raid partition in Linux
How to configure Software RAID 1 mirroring in Linux
How to prevent a command from getting stored in history in Linux