I am creating a startup script (called from rc.local) in Debian Squeeze. The startup script checks for a variable value from a file, decrements the variable and writes it back to the file, then if the variable was greater than 0 then it executes a test and reboots the system. If the variable is 0 or less than 0, then it doesn't reboot the system. My question is as follows: Suppose I realize after a couple of tests that there is a bug in the test. Is there any way to break the execute_test->reboot->repeat loop that I have set up. Putting a "sleep 1000" in the test or doing a ps aux|grep might work, but I am not sure if I shall have access to them before the rc.local scripts have run. What if I run the script in the background instead of the foreground? Would I have access to bash login shell etc. while the test is running in the background in that case?
COUNT=`cat $testFile|wc -l` if [ $COUNT -gt 0 ];then ARGS=`head -1 $testFile` cd /testCode /testCode/startTest.sh $ARGS sed -i '1d' $testFile echo "rebooting" /sbin/reboot & exit 0 fi
I know I have given very few details, since I am not sure what information would be required. I will update the question as required.
UPDATE: I ran the test. I get the login prompt before the test finishes. I had though that I would get the login prompt only after rc.local is done executing. Could someone throw light on that?