Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-24-2004, 11:51 AM   #1
LQ Newbie
Registered: Mar 2004
Distribution: Debian
Posts: 22

Rep: Reputation: 15
Running programs via ssh

I'm trying to run some programs on a remote machine, via ssh. I can execute them, and they run fine... so long as my terminal remains open. But when I shut it out, they stop. Is there any way I can get these to run entirely in the background, and not be dependant upon my terminal being open?
Old 04-24-2004, 01:58 PM   #2
Registered: Apr 2003
Location: Vancouver, BC
Distribution: Slackware, Ubuntu
Posts: 558

Rep: Reputation: 31
Use screen. There is an excellent tutorial at about screen.


user@mydomain# ssh myhost@mydomain
myhost@mydomain # screen
myhost@mydomain # ./program
(program starts running)

Press Ctrl-a-d to exit screen session; you're back to the original prompt on myhost@mydomain. You can now exit your ssh session.

To restore your screen session, ssh into myhost@mydomain as before, then do:

myhost@mydomain # screen -r

Last edited by spurious; 04-24-2004 at 02:00 PM.
Old 04-24-2004, 04:06 PM   #3
Registered: Mar 2004
Location: York, UK
Distribution: Ubuntu
Posts: 132

Rep: Reputation: 15
The reason that your programs are terminated when your shell terminates is because your shell is sending them a HUP signal when it ends. Two ways to get around this:
  • Start the program using "nohup", such as "nohup wget"
  • After starting a program, stop it with ctrl+z. Then continue its execution in the background using "bg". Then order the shell to disown the process using "disown". See the bash manual for details of bg and disown.


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
running programs jdarvwill Linux - Software 3 10-05-2005 11:15 PM
Limiting what programs you can start via ssh garion Linux - Security 2 09-17-2005 06:28 AM
Graphical Programs over ssh andrewguy9 Linux - Software 2 02-24-2005 09:30 AM
Help on Running Programs mooreted Linux - Software 3 05-16-2003 11:32 PM
Running programs via SSH DJFauß Linux - General 5 05-22-2001 12:33 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration