Why does my custom rc.d script hang?


Recommended Posts

I'm using the flash/custom/etc/rc.d script method and I have a problem with one of the scripts.

 

My /custom/etc/rc.d folder contains:

 

rc.local_startup
S01_my_script
S02-install_custom_packages
S99-finish

 

S99-finish contains:

 

/boot/unmenu/uu
/boot/bin/cached.sh

 

At the end of the execution of S99-finish the terminal is hung, I can type characters, but there is no command prompt.  Any ideas?

 

???

 

 

Link to comment

The Linux gurus can probably help much better than I can, but I'll start the ball rolling by asking the obvious questions, to determine how far it got before abnormal behavior began.  Can you determine if both UnMENU and cached.sh are successfully running?  Try ps -eaf or UnMENU:SystemInfo:PS Info, and check to see that the appropriate processes are running, with all the correct command line parameters.

 

That sounds like stdin may have been inadvertently redirected to standard input, the keyboard.  Examine both uu and cached.sh for perfect syntax, especially the use of the < and |.

Link to comment

 

Try putting a & in this line of your S99-finish:

 

/boot/unmenu/uu &

 

Purko

 

Unlikely to be the answer, but you can try.  More likely you do not have a newline at the end of a line, or at the end of the last line, or a syntax error.

 

Joe L.

 

try the following mods.

 

#!/bin/bash 
/boot/unmenu/uu &
/boot/bin/cached.sh &
sleep 1
echo "$0: complete"

 

 

Link to comment

Change the /boot/unmenu/uu line in your S99-finish file to  echo "/boot/unmenu/uu" | at now + 1 minute

 

What you are seeing is a problem with the bash shell.. what is happening if I understand it 100% correctly is the following:

 

Your file (S99-finish) is being "triggered" by a line in the rc.local_startup file that pipes your file to the shell for execution.  This causes you file to start a parent process. When you trigger the execution of the uu script on with the line "/boot/unmenu/uu ", you are starting a child process (uu script) from the parent (your S99-finish script).  The uu script contains a command that starts unmenu and that line ends with a "&".  This means put the command into the background and don't look at the status of it any more.  The child process never responds to the parent and you get a deadlock with the parent.

 

here is a link to the thread where I pointed out this problem before:

http://lime-technology.com/forum/index.php?topic=3666.msg34020#msg34020

There is a link on my next post in this thread with an external link to where I was first tipped off of the problem while researching.

 

Cheers,

Matt

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.