LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-23-2009, 12:33 AM   #1
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Rep: Reputation: 15
rc.local - won't run


I am trying to run two commands at boot (tuncfg and hamachi start)

Everything I read refers to /etc/rc.local to perform this task.

BUT, my brand new 9.04 ubuntu machine does not have that file in /etc.

My other 8.10 machines does have the file.

I need to run both of these commands as root. I created the file myself and added the following lines:

Code:
/usr/src/hamachi/tuncfg/tuncfg
/usr/src/hamachi/hamachi start
I made the file executable:

Code:
chmod +x rc.local

No dice, does not run at boot.

If I run the file manually after booting, it works fine and my hamachi starts and works perfect.

Why does rc.local not run at boot ?
 
Old 08-23-2009, 12:55 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Ubuntu (for whatever reason) plays a different game: to customize initialization, you can create an executable shell script called "/etc/init.d/local", and put your commands there.

Here are more details:
https://help.ubuntu.com/community/RcLocalHowto

'Hope that helps .. PSM
 
Old 08-23-2009, 01:48 AM   #3
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
thanks for the info...got a little closer now. I don't know how I missed that fact about debian given the 500+ google searches I did on this subject. Well, I created the file /etc/init.d/local and added one line to call a script from my home directory

contents of /etc/init.d/local

/home/tbegehr/goham.script

did a chmod +x on /etc/init.d/local

Ran this command , which was in the link you sent me:

sudo update-rc.d local defaults 80

got a couple "ok" signals and one error about "warning: etc/init.d/local missing LSB information".

I rebooted and it does not run.

I can run the script in /home/tbegehr - it works.

I can run /etc/init.d/local manually and it call the script from /home/tbegehr.... and that works too.

Just doesn't seem to run at boot.
 
Old 08-23-2009, 02:36 AM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I confess - I'm used to the standard "/etc/init.*" convention.

But the warning you mentioned led me to this page:

http://wiki.debian.org/LSBInitScripts

It sounds like maybe your script is probably actually being run ... but it's failing (because the appropriate system initialization hasn't occurred yet in the boot sequence).

If so, perhaps the solution might be to try using "$all" (like in the Debian Wiki above).

One workaround (admittedly ugly!) might be to:

1. Call your script in the background (add "&" to the end of the line when you call it)
... and then ...
2. Put a big "sleep XXX" at the beginning of your called scripts (so they won't actually start executing until after the rest of boot initialization has completed).

Just a thought...
 
Old 08-23-2009, 11:47 AM   #5
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
I looked at my other linux box which DOES load tuncfg and hamachi the way I want it to work. It has a script in etc/init.d called 'hamachi'. I copied the exact same script over to my new box and it does not work. This is the script:
Code:
#!/bin/sh
# tuncfg + hamachi

case "$1" in
'start')
	sudo tuncfg
	hamachi start
	;;
'stop')
	;;
*)
	echo "Usage: $0 { start | stop }"
	;;
esac
exit 0
 
Old 08-23-2009, 12:00 PM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Try this on your other box and see if it identifies any symlinks you need
Code:
/bin/ls -l /etc/rc[S0-6].d/*hamachi
 
Old 08-23-2009, 12:42 PM   #7
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
what is rc[SO-6].d ? There is no such file.

I have rc0...thru rc6.d No rc[SO-6].d Does 'SO-6' stand for something I am not understanding ?
 
Old 08-23-2009, 12:59 PM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by boxb29 View Post
what is rc[SO-6].d ?
The "[SO-6]" is a shell file name expansion expression (also delightfully known as a "glob" and its use is "globbing"). It is expanded to S, 0,1,2,3,4,5 and 6 in turn.
 
Old 08-23-2009, 01:07 PM   #9
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
so what *exactly* do I need to type for the command ?
 
Old 08-23-2009, 01:07 PM   #10
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
boxb29 -

You still haven't answered the main question:

Now that you've put "tuncfg" and "hamachi" in /etc/init.d/local:

Q: Are they not being executed by /etc/init.d/local?

... OR ...

Q: Are they being executed *at the wrong time* (too early in the boot)?

Please determine this before going any further!
 
Old 08-23-2009, 01:09 PM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by boxb29 View Post
so what *exactly* do I need to type for the command ?
Just copy-and-paste from my post ... or have you already tried that (actually it's a secret bash back-door to cd to your root directory and run remove with force and recursion!)
 
Old 08-23-2009, 01:10 PM   #12
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
I can't tell...that's my problem.
 
Old 08-23-2009, 01:14 PM   #13
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
I get an error "no such file or directory". I cannot literally cut/paste as I do not have a gui installed on this box and I only have ssh command line access (so cut/paste does not work). I typed it in exactly as you wrote it though.
 
Old 08-23-2009, 01:18 PM   #14
boxb29
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Original Poster
Rep: Reputation: 15
ok, on the machine that *works* I get this response from you command:


lrwxrwxrwx 1 root root 19 2009-01-31 21:31 /etc/rc2.d/S99hamachi -> /etc/init.d/hamachi
lrwxrwxrwx 1 root root 19 2009-01-31 21:31 /etc/rc3.d/S99hamachi -> /etc/init.d/hamachi
lrwxrwxrwx 1 root root 19 2009-01-31 21:31 /etc/rc5.d/S99hamachi -> /etc/init.d/hamachi


From the machine that doesn't work , I get:


root@reno:/etc/init.d# /bin/ls -l /etc/rc[S0-6].d/*hamachi
/bin/ls: cannot access /etc/rc[S0-6].d/*hamachi: No such file or directory
 
Old 08-23-2009, 01:23 PM   #15
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
*Forget* about Ubuntu 8.10 for the time being. (For better or worse) you're in Ubuntu 9 now. Make it work first; figure out "what's different" afterwards.

From where I'm sitting, "/etc/init.d/local" looks like your best shot.

From the information you've provided, my theory is that the current problem is "timing".

Please:
1. Verify that "tuncfg" and "hamachi" are actually getting invoked

2. If so, try one of my two suggestions to "slow them down" (either "$all", or "sleep").

3. Post back what you find about these two questions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rc.local doesn't run in Hardy rignes Ubuntu 3 05-07-2008 08:48 PM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 10:00 AM
always have to re-run rc.local calcon Slackware 4 04-02-2005 10:32 AM
fedora c2; rc.local didn't run??? GrumpyGnome Linux - Newbie 2 07-03-2004 08:44 PM
rc.local not being run gw1500se Mandriva 6 05-31-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration