LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Running Program Through SSH (https://www.linuxquestions.org/questions/linux-general-1/running-program-through-ssh-368429/)

windisch 09-30-2005 07:28 AM

Running Program Through SSH
 
I'm sure this is an easy question, I'm just sure on how to do this. When I connect to my linux box through ssh, and run a program, the program quits when I close ssh. What is the command to keep the program running when I exit ssh?

Artanicus 09-30-2005 08:53 AM

The best solution IMO is screen.
Code:

man screen
will tell you all you need to know, but its a tedious read. However, searching the internet for eg. 'screen tutorial' will get you on track (:

windisch 09-30-2005 09:27 AM

Screen is where I should look? Great, thanks for your help!

imitheos 09-30-2005 04:17 PM

Quote:

Originally posted by windisch
Screen is where I should look? Great, thanks for your help!
It depends on what you want to do.
Artanicus mentioned screen which is a good program, but as i said there are many solutions according to what you want.

What you want is the application to be detached from your terminal.
For example if you want to run "wget" it has a "-b" option that runs on background.
Look maybe your application has some option for this.

If not there is the "nohup" (no hang up) program that detaches applications from the terminal.
for example "nohup program &" and then you exit the ssh session.
run "man nohup"

If you want to do something complicated or you want to be able to grab the session back then screen is one of the programs
that do this job as Artanicus said.
for example you want to leave a IRC session and then be able to grab it again.

Maybe if you say what you want to run, we can be of better assistance.

windisch 10-03-2005 06:14 AM

Its just a couple programs and a script I created with the help of some great guys on this forum. sc_trans_linux which is a shoutcast server, and a script that monitors songs played and songs requested. I'll just play with all of the options you've mentioned, and see what works. Thanks for your help.

tkedwards 10-03-2005 07:31 PM

Yeah I think screen is the way to go, nohup will detatch the program from your terminal so it'll keep running when you logout but you won't be able to get back to the program AFAIK.

windisch 10-04-2005 06:10 AM

I played with both and agree that screen is the way to go for me. I can easily have 2 screens open so I can connect back and see the status. Thanks for your help guys!


All times are GMT -5. The time now is 12:14 AM.