LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I start an app and make it run from it's own directory? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-start-an-app-and-make-it-run-from-its-own-directory-816436/)

Red Squirrel 06-25-2010 08:28 PM

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.

paulsm4 06-25-2010 09:36 PM

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


All times are GMT -5. The time now is 09:24 AM.