I wrote a custom rc.local file which installs some software when it runs after the first reboot and then deletes itself so it's run only once. My rc.local looks like this(editted for brevity):
Code:
#!/bin/sh
clear
echo " Post-Install Setup "
echo " "
rpm -ivh /root/mycustom.rpm
#restore original rc.local
mv -f /etc/rc.d/rc.local /etc/rc.d/rc.local_custom
cp /etc/rc.d/rc.local.orig /etc/rc.d/rc.local
echo " Install FINISHED! "
echo " Press ENTER to reboot "
read X
reboot
exit 0
The script works fine and installs my rpm properly. The only issue I have is when I leave the computer when this runs, I get autologoffed after awhile. Rather than coming back to see a "Press ENTER to reboot" message awaiting my input, I only see the console login screen (the computer is set to run level 3 BTW). The screen was cleared as well so I don't see any output from my script. I estimate I get logged off after 1-2 hours. I need to check the output from my script so it's important I don't get logged off.
In addition, after I enter a login name and press enter at the login prompt, the computer will reboot itself as the reboot command from my rc.local script is still waiting to be executed.
How can I turn off this autologoff feature when running this rc.local script?
Also when the rc.local is run, does it use the profile of the root user? I checked the shell config files and don't see TMOUT or autologout set. Just to be safe, I tried adding the following lines before read X in my rc.local script but I was still logged out:
TMOUT=0
unset autologout
Any ideas? Thanks.