LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2013, 01:12 PM   #1
Xtrato
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Rep: Reputation: Disabled
rc.local wont start my program at boot


Im having trouble getting a command to run when the computer has booted. Im using the rc.local file to try and do this. The 3 lines i have added to the file are below:

Code:
kismet_server > /root/logfile.txt &
sleep 10s
python /scripts/kismetstatus.py &
Basically i want the kismet_server application to run at startup and any output it produces to be sent to a text file at /root/logfile.txt. This program runs indefinitely. After that has started the kismetstatus.py script runs which is used to check the file etc..

The problem is strange because the logfile.txt is created but nothing is written to it. If i enter the commands manually when the computer is on it all works perfectly fine. It just dosn't seem to work when attempting to start it automatically at boot.

I have tried adding these lines to both /etc/rc.local and /etc/init.d/rc.local and both produce the same results.

Is there any reason this may be happening? or an alternative way i can make a program start at boot time.

Thankyou in advance for your help.

Last edited by Xtrato; 01-21-2013 at 01:14 PM.
 
Old 01-21-2013, 01:19 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
What system are you trying to do this on?

If it is a current Fedora, it is entirely possible that the network you are trying to listen on doesn't exist at the time it tries to start.

There are NO guarantees that rc.local actually runs at the proper time. Fedora now being systemd based, tries to start everything at once. So unless you add explicit chains to the "after:" lists to try to force it... it will run before the network is even initialized.
 
Old 01-21-2013, 01:22 PM   #3
TroN-0074
Senior Member
 
Registered: Dec 2011
Location: Michigan USA
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
I believe each distro works differently, so what distribution are you working with?
some distros now use systemd and think systemd doesnt use rc.local at all. I am no 100% in this hopefully somebody here with more experience can see your post.
 
Old 01-21-2013, 01:48 PM   #4
Xtrato
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you for the reply's. It is a Debian based distro that running on a Raspberry PI computer. I have a print statement in the python script and i can see that is is infact starting when the computer starts.

If the network interface dosn't have time to start i would still expect to see logfile.txt contain the error that the interface diddnt start.

It is just the problem of the logfile.txt not being written to in any way, even though executing the exact same command manually works perfectly fine.
 
Old 01-21-2013, 02:16 PM   #5
0siris
LQ Newbie
 
Registered: Sep 2011
Location: IL, USA
Distribution: Absolute Linux
Posts: 6

Rep: Reputation: Disabled
Is it possible that the Kismet server is, in fact, logging to its default location instead of to the logfile.txt that you want it to use?

I think that would be the final proof that the problem is the order things are starting up.
 
Old 01-21-2013, 08:39 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Unless the program daemonizes itself, it'll terminate when rc.local (actually the process running rc.local) finishes.
Try prefixing with 'nohup' as well.
 
Old 01-22-2013, 03:46 AM   #7
Xtrato
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
Unless the program daemonizes itself, it'll terminate when rc.local (actually the process running rc.local) finishes.
Try prefixing with 'nohup' as well.
Thanks for the suggestion! I will give it a try when i get back home tonight.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Modified the /etc/rc.local file. Now fedora wont boot h8null Linux - General 6 07-27-2009 09:20 AM
Boot.local wont launch sh FLCL SUSE / openSUSE 3 05-21-2009 12:42 AM
Program wont start on boot SBN Linux - General 2 11-10-2007 04:41 PM
Wine wont start program, segmentation fault, artsdsp nontoxic Linux - Software 3 03-21-2005 07:27 AM
Error while trying to start a program on a local X session. Vorik Linux - Software 0 01-28-2005 02:50 PM


All times are GMT -5. The time now is 05:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration