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 10-27-2003, 03:00 AM   #1
LQ Guru
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
leave process running after logoff

i have a machine without a monitor so i use ssh to control it but how can i leave a program running after i log off..
Old 10-27-2003, 06:28 AM   #2
Registered: Aug 2003
Location: New Delhi, India
Distribution: RHEL AS 3/4, Windows XP
Posts: 546

Rep: Reputation: 31
To keep a program running while not logged on, you need to use the prefix your command with the word nohup. You will need to run this command in the background.

for example:

$ nohup grep 'director' emp.lst & | nohup sort &

The above command will search the file 'emp.lst' for the word 'director' and then the entire output from the first command is sent to the 'sort' command which arranges the results in ASCII sequence. Note the use of ampersand sign (&), which keeps the job running in the background.


Old 10-27-2003, 07:26 AM   #3
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Use screen. I love it, it's very versatile and pretty simple to use.
Example: I use the pftp-mew FTP client. If I want to download something to my home computer from school or work I just SSH to my home box, type screen pftp to launch a screen session running pftp. I start up a download and then press Ctrl+A and then Ctrl+D to disconnect from the screen. You will be returned to your shell. Log off if you want to. Later on you can log in and reconnect to the screen session using screen -r to see how your download is progressing.

You can also type screen without any parameters. This will launch a screen session running bash (if that's your default shell). Start compiling or whatever you want, then again use Ctrl+A, Ctrl+D to detach from the session. I use this frequently (all the time actually) to run my Enemy Territory server. It works with pretty much any console application and it's darn handy. You can have several sessions going on at the same time, divided into different "windows" (I don't recall the correct term at the moment, sorry).
Start a new screen session, and then type Ctrl+A, Ctrl+C to create a new window. You can run anything here (as usual), then type Ctrl+A, Ctrl+C again to create a third window. You can now run three programs at the same time and switch between the different windows using Ctrl+0 (for the first window you created), Ctrl+1 (for the second), Ctrl+2....etc.

Read up on the man page for more info: man screen
If you don't have screen installed you should be able to grab it from your distribution as it's a very common tool.

Old 04-07-2004, 12:42 PM   #4
Registered: Jul 2003
Posts: 33

Rep: Reputation: 15
thansk for the tip hw-tph but that didn't work for my purposes. It kind of behaves like &. Somehow my app only works when being started from the console.

Old 04-09-2004, 02:21 AM   #5
Registered: Feb 2004
Location: AT
Distribution: debian etch and SUSE 10.2
Posts: 123

Rep: Reputation: 15
I think there was somthing like log out with CTRL+D and than sending ~ to the terminal...


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 a process during boot anegbi Linux - Software 3 11-30-2005 03:08 AM
Running process sonu1082 Linux - Software 2 11-25-2004 05:32 AM
Process not running LinuxRam Linux - Newbie 4 09-09-2004 12:45 AM
How to prune a print & file server to leave minimal services running wolfpeach Linux - Security 4 06-29-2004 06:35 AM
[trick] Leave console free for apps while running X vfs Slackware 17 05-18-2002 09:36 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:26 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