LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Alias to run a program in the background (https://www.linuxquestions.org/questions/linux-newbie-8/alias-to-run-a-program-in-the-background-866428/)

diamond_D 03-04-2011 09:45 AM

Alias to run a program in the background
 
I have a n00b question.

I'm running Utorrent server and I figure I would create an alias to launch the program and run it in the background.

alias utorrent='/home/user1/software/utorrent-server-3.0/utserver &'

It seems to run the program but the associated webui program is flaky and won't start correctly.

If I manually go to the specified path and run the command ./utserver & , I never seem to have an issue with the webui.
I was wondering if this could possibly have anything to do with using the '&' ampersand operator in an alias.

szboardstretcher 03-04-2011 10:04 AM

Quote:

Originally Posted by diamond_D (Post 4278923)
I have a n00b question.

I'm running Utorrent server and I figure I would create an alias to launch the program and run it in the background.

alias utorrent='/home/user1/software/utorrent-server-3.0/utserver &'

It seems to run the program but the associated webui program is flaky and won't start correctly.

If I manually go to the specified path and run the command ./utserver & , I never seem to have an issue with the webui.
I was wondering if this could possibly have anything to do with using the '&' ampersand operator in an alias.

To make an alias that might work:

Code:

alias utorrent="cd /home/user1/software/utorrent-server-3.0/; ./utserver &"
or a function in .bashrc:

Code:

function utserver () {
cd /home/user1/software/utorrent-server-3.0/;
./utserver & }


diamond_D 03-05-2011 10:47 AM

Code:

alias utorrent="cd /home/user1/software/utorrent-server-3.0/; ./utserver &"
Your alias above works but I'm trying to understand the logic. My original alias had the full path to the program so shouldn't I be able to execute 'utserver' without using the . dot operator. Then I figured I would export the full path to my .bashrc and login again to see if that made any difference but it didn't.

The only way I can get the webui to work properly is if I launch the program using the ./ dot operator from the local directory. If anybody can help explain why, I would much appreciate.

avangel 05-04-2012 05:04 PM

nohup
 
I was looking for something similar, e.g. start eclipse from a specific path.
I found a nice tutorial regarding nohup at http://www.quantprinciple.com/invest...ix/jobcontrol/ .
I think that's the correct way to do it.


All times are GMT -5. The time now is 01:56 AM.