How can I run a script on the first book of my rhel 5 server after install.
I am using post kickstart tasks to create a script and I'd like to run it the first time the server boots. How can I do this?
I'd like to use the "firstboot" service
Is there any reason you NEED to use the firstboot service?
Take a look at: How to run script on first boot?
Create a script that tests for the existence or absence of a file. As the last step of a successful run of the script create/delete the status file. When preparing your image, you need to make sure the your status file is in the correct state.
I came across the same problem; solved it by using the profile.d facility. In my case I had to be sure a file was present. If so then execute the file; after which I move the shell script from the profile.d directory to /tmp.
echo "Configure NVIDIA - xconfig."
cat << EOF > /etc/profile.d/configure_nvidia.sh
if [[ \$UID -ne 0 ]] ; then return 1 ; fi
if [ -f "/usr/bin/nvidia-xconfig" ]
then
mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.bk
/usr/bin/nvidia-xconfig
mv -f /etc/profile.d/configure_nvidia.sh /tmp
fi
EOF
Jos Plas