• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: rc.local not running  (Read 2626 times)
jfalk
Newbie
*

Karma: 0
Posts: 1


View Profile
« on: September 04, 2010, 05:11:22 AM »

Just got my Guruplug and I'm having great fun trying to figure it out.  I have a small bit of Linux knowledge, and I'm trying to use the Guruplug to augment it.  So take it slow, guys.  Everything seems to be working quite well except that rc.local appears not to b executing.  I know this because it only has two lines, one of which mounts my USB drive with write capability andI have to unmount and mount again after every boot.  The second is even more obvious... it creates /var/cache/apt/partial and I can't run apt-get without recreating it after every boot.  Searching this forum suggests that the an error seems to have aborted the script.  I have two questions:  how can I tell this (I'm kinda clueless on logging) and these two command are so simple that that seems unlikely.  Hopefully my next post will be a little more challenging.
Logged

msrk
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #1 on: September 14, 2010, 12:17:31 PM »

Interesting...  I am having the same problem.  I posted a question here: http://plugcomputer.org/plugforum/index.php?topic=2289.0 but no one has replied yet.
Logged

big_ignoramus
Newbie
*

Karma: 1
Posts: 29


View Profile
« Reply #2 on: September 14, 2010, 09:26:34 PM »

(I'm kinda clueless on logging)

You can view the system log by typing dmesg at the command prompt. Hopefully that will provide you some good information.
Logged

bdewacht
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #3 on: October 15, 2010, 06:37:09 PM »

The linux system has a more complicated "autoexec.bat" system in place (for those who remember the dos days).
When the kernel boots, it looks for a process called init, which is the mother of all other processes.

Init uses different runlevels, which indicate different "states" of the system, which depend on the flavour of linux you are using.

runlevel 1 is commonly used for single user access
runlevel 2 on Ubuntu is the standard level (on other systems this goes to 5).
runlevel 6 is commonly reboot.

When init changes to a certain runlevel, it executes all scripts starting with S in the /etc/rc<x>.d/ directory (x stands for the runlevel).
These scripts are executed in alphabethical order, so S00 is executed before S01, etc.

When init exits a certain runlevel it executes all scripts starting with  K in the /etc/rc<x>.d/ directory.

Your rc.local script is linux distribution (Ubuntu) specific, and is probably called from another rc2.d/S.... script (I am not very familiar with Ubuntu). If this script fails, the rc.local script is not executed.

CONCLUSION:

If you want to execute some commands, regardless of the outcome of the other scripts, add an S00_myscript script in /etc/rc2.d and this will do the trick.
If you want it to execute say, after starting sshd, adjust the 00 to something bigger than the SXY starting sshd.

NOTE:

1/ Normally in rc<x>.d you make a symlink to the actual script which is in /etc/init.d. init calls the Sxy scripts with first parameter start and the Kxy scripts with first parameter stop
. So normally you will have an Sxy and Kxy link to the same script in /etc/init.d

2/ If want to know the current runlevel do echo $RUNLEVEL
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #4 on: October 16, 2010, 05:12:47 PM »

When init changes to a certain runlevel, it executes all scripts starting with S in the /etc/rc<x>.d/ directory
Actually - it does whatever the /etc/inittab files says it should do for the new level.  That is usually to run the /etc/init.d/rc script with the new level as the parameter and it is this script that runs the init.d scripts.
Quote
2/ If want to know the current runlevel do echo $RUNLEVEL
Not set for me. 
Quote
who -r
works  (edit:) as does the simpler
Quote
runlevel
« Last Edit: October 16, 2010, 05:47:06 PM by birdman » Logged

Pages: [1]
Print
Jump to: