• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: /etc/rc.local not getting run?  (Read 4212 times)
CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« on: August 04, 2009, 01:42:01 PM »

I am new to ShPlg, [and not heavy user of *nix]

When trying to add the mkdir  for apt-get dir to my /etc/rc.local, I noticed the line was already there.  It does not appear to be run, since the path is not there after I login.   The script does have execute permissions 755.  Any suggestions?

---------
#!/bin/sh -e
#
# rc.local

insmod /boot/fat.ko
insmod /boot/vfat.ko
mkdir -p /var/cache/apt/archives/partial
/root/discoverd
cd /
#./demo.sh
date 012618002009
hwclock -w

exit 0
---------

If I manually execute this script, both the insmod lines give errors.

Any suggestions?
Logged

Cordially, CqCn

dattaway
Jr. Member
**

Karma: 5
Posts: 91



View Profile WWW
« Reply #1 on: August 04, 2009, 02:52:20 PM »

Is rc.local listed in your runlevel directory?
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 440


View Profile WWW
« Reply #2 on: August 04, 2009, 04:07:03 PM »

You may not want to run that as is anyway.  It's going to set the system time to a fixed time (18:00, Jan 26, 2009), and then set the hardware clock based on that.  Seems a very strange thing for a boot script to be doing.
Logged

hypn0toad
Newbie
*

Karma: 0
Posts: 29


View Profile
« Reply #3 on: August 05, 2009, 08:21:23 AM »

I noticed the same thing... I'm guessing it is running and erroring out with the first two lines.

What are those supposed to do?  Maybe ill wipe the file and make my own with just that makedr command and see if it works
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #4 on: August 05, 2009, 09:40:38 AM »

Is rc.local listed in your runlevel directory?
dattaway, How do I check for this?

But the answer, I guess, is yes.  After commenting out the first two insmod lines, the rest of the lines seem to be effective.
Logged

Cordially, CqCn

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #5 on: August 05, 2009, 09:51:14 AM »

You may not want to run that as is anyway.  It's going to set the system time to a fixed time (18:00, Jan 26, 2009), and then set the hardware clock based on that.  Seems a very strange thing for a boot script to be doing.
I was wondering about this fixed date.  My guess is that, some other function was failing without the date set.  Somebody kludged it up this way ??

I have inserted the ntpdate script (already in the system) just before the hwclock, thusly

date 012618002009
/usr/sbin/ntpdate-debian
hwclock -w

I left the static date set as is, thinking that if ntpdate did not succeed for some reason (internet not working while booting up), date would still have an incorrect, but valid value.
Logged

Cordially, CqCn

birdman
Sr. Member
****

Karma: 4
Posts: 440


View Profile WWW
« Reply #6 on: August 05, 2009, 04:55:26 PM »

But, if you are setting the hardware clock it presumably has one.  Why would you want to set it everytime?  Why not read from it to get the time first, rather than hardwire January 2009?
The time to set it is on shutdown. And every hour with a cron job (to cover crashes, which don't have a shutdown).
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #7 on: August 05, 2009, 07:15:05 PM »

But, if you are setting the hardware clock it presumably has one.  Why would you want to set it everytime?  Why not read from it to get the time first, rather than hardwire January 2009?
The time to set it is on shutdown. And every hour with a cron job (to cover crashes, which don't have a shutdown).
birdman,  my thinking is similar.  But I wonder why it was done that way though.  I sort of assume that these distributions are setup by experienced people who know what they are doing Smiley

Anyway, combining your idea, and addressing my concern, a sequence might be,
hwclock -r
/usr/sbin/ntpdate-debian
hwclock -w

The last one assuming, the internal clock is very bad, and the machine may be unplugged for long periods.  So at least on bootup, if network is available, the clock is syncd again.  I know, the hwclock setup, and the auto adjust is a rather involved process, and a lot of good thinking/practice is out there.  Probably one should find out the accepted best practice for this...
« Last Edit: August 06, 2009, 08:24:59 AM by CqCn » Logged

Cordially, CqCn

Pages: [1]
Print
Jump to: