LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-25-2010, 08:28 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,327

Rep: Reputation: 54
How do I start an app and make it run from it's own directory?


For any custom application I create which needs to run at startup, what I normally do is have an entry in my /etc/init.local that executes the app.

Now if I just put

Code:
/data/app/prod/start &
And the app writes data to relative paths, it will be writing data all over the system. Is there a method of starting a script so it is aware of the folder it is in? Sure I can do "cd [folder]" then start the app, but wondering if there's a better way.

Last edited by Red Squirrel; 06-25-2010 at 08:30 PM.
 
Old 06-25-2010, 09:36 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

1. You can do a "cd SOMEDIR" before you can invoke the program
... and/or ...
2. The program can parse the path from argv[0] when it starts up

'Hope that helps .. PSM
 
  


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
[SOLVED] Binutils error: Source directory already configured; run make distclean there first?! PhoenixzeroX Linux From Scratch 4 06-03-2012 09:44 AM
[SOLVED] can not start jar app using symlink in different directory due to file not found! nocountryman Linux - Software 4 03-17-2010 04:11 AM
How can i make app to run without path like Firefox and others? QueenZ Linux - Newbie 11 02-16-2009 06:07 AM
bash - start app, [do stuff], kill started app MiniMe001 Programming 3 03-19-2008 03:06 PM
How to make a program run at start up time. TruongAn Linux - Software 22 10-26-2005 06:50 PM

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

All times are GMT -5. The time now is 08:33 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