LinuxQuestions.org
Help answer threads with 0 replies.
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 04-01-2014, 06:29 PM   #1
The Caheybee
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Rep: Reputation: Disabled
Working directory for program start at boot


I've written a program that I would like to run at boot/startup but have a problem getting it to run.

My program 'mcumonitor' and settings file are located in /usr/bin.

I added ./usr/bin/mcumonitor to /etc/init.d/rc.local but it fails to run properly, I believe because it's looking for the settings file in the wrong place.

Is there a way to set the working directory for the program from rc.local or am I best to just hard code the settings file location explicitly within my program.

Many thanks,
The Cageybee (yeah, I mistyped my username at registration. lol)
 
Old 04-02-2014, 05:19 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Well, starting the path with a dot '.' isn't going to help, that means a path relative to whatever $PWD happens to be (at the time).
I think you meant to use the absolute path instead.
 
Old 04-02-2014, 07:44 AM   #3
The Caheybee
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Tried. Unfortunately that makes no difference.
 
Old 04-02-2014, 08:30 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,350

Rep: Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908Reputation: 1908
What linux distribution / version are you running?

Does your program run at all? It depends on the distribution but typically you would add the line to the /etc/rc.local file and not /etc/init.d/rc.local. The later configures /etc/rc.local to start for the particular run level.

If the program does run then is mcumonitor trying to open the settings file with a relative or absolute path? Make sure it uses an absolute path. Typically settings i.e. configuration files are placed in the /etc/ directory.
 
Old 04-02-2014, 08:40 AM   #5
The Caheybee
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
I'm running Ubuntu 12.04 LTS. Well, it's kinda a hacked-up version as it's running on ARM.

I've tried running things from /etc/rc.local before but it never seems to get called. Not sure why.

I've managed to get around the problem for now by just hard coding the settings file location in my program which is working.

Many thanks for your help guys,
The Cageybee
 
  


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
start up program after boot SyCo123 Linux - General 2 03-10-2008 01:02 PM
To start a program from any directory amanjsingh Linux - Newbie 3 12-15-2006 12:43 AM
Start program at boot The_paladin Debian 2 08-08-2006 02:30 PM
start program on boot AZaraT Linux - Newbie 6 06-26-2006 06:26 PM
How do I start a program on boot ? overproof Mandriva 4 04-22-2005 08:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:16 PM.

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