Is there a time limit on startup script (rc.local) before moved to background process?

Pat patchu1 at yahoo.com
Fri May 19 20:00:47 UTC 2006


Part of my kickstart install involving writing a
run-once rc.local script which executes after the
first reboot. At the end of this script, I need the
script to wait for human input and then reboot after
the input. 

The problem is after about 1-2 hours, the screen is
cleared and I get the console login screen. Any ideas
on what is causing this and how to disable it? 

My first thought was autologout was to blame. However,
I checked the shell scripts and environment variable
and nowhere is TMOUT or autologout set. I don't
actually login to run rc.local either. To be safe I
added 'TMOUT=0' and 'unset autologout' to my rc.local
script but that does not solve it. 

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 "
TMOUT=0
unset autologout
read X
reboot
exit 0
[/CODE]


The script works fine and installs my rpm properly.
The only issue I have is when I leave the computer for
an extended period of time while it runs, 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 so it seems
the boot process just continued on and didn't wait for
rc.local to exit? It didn't kill the rc.local proces
though (read below). The screen was cleared as well so
I don't see any output from my script. 


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 in the background.

Some other things I've tried is putting in a
continuous loop waiting for input:

[CODE]
<snipped>
reply=none
until [ "$reply" = "REBOOT" -o "$reply" = "reboot" ]
do
	read -t 60 reply
done
reboot
exit 0
EOF
[/CODE]

That doesn't work either as I still get a login
screen. I can't login properly though as it seem input
is still being read by the read command. So the script
still seems to be running in the background.

Another thing I tried is a long sleep statement in the
rc.local, however that doesn't keep my rc.local script
on the screen either as I get the login screen. When I
login however, I can view the rc.local process still
running though in the background:

[root at mycomputer ~]# ps -ef | grep local
root      2476  1503  0 May18 ?        00:00:00
/bin/sh /etc/rc3.d/S99local start

(Note: S99local is a link to rc.local)

I'm pulling my hair out on this one. How can I prevent
the login screen from being moved to the background
and keep it on the terminal indefinitely until user
enters something? 

Any clues or tips would be appreciated! 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the redhat-sysadmin-list mailing list