LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-30-2005, 07:28 AM   #1
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Rep: Reputation: 30
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?
 
Old 09-30-2005, 08:53 AM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
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 (:
 
Old 09-30-2005, 09:27 AM   #3
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
Screen is where I should look? Great, thanks for your help!
 
Old 09-30-2005, 04:17 PM   #4
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
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.
 
Old 10-03-2005, 06:14 AM   #5
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
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.
 
Old 10-03-2005, 07:31 PM   #6
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
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.
 
Old 10-04-2005, 06:10 AM   #7
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
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!
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping a program running between SSH sessions ark86 Linux - Newbie 2 10-01-2005 03:31 PM
Running a program in the background - SSH ziggo0 Linux - Newbie 4 03-05-2005 01:30 PM
running ssh on redhat 8.0 sheek Linux - Newbie 2 07-22-2003 06:46 PM
Launching X Program from SSH deckmoney Linux - General 4 04-16-2003 04:34 PM
Running X through SSH cdakin Linux - Newbie 0 04-23-2002 08:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:33 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
Open Source Consulting | Domain Registration