Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-28-2005, 11:23 AM   #1
LQ Newbie
Registered: Sep 2003
Location: Ljunghusen, Sweden
Distribution: RH6, debian
Posts: 23

Rep: Reputation: 15
Question How to reactivate process sent to background


I am currently running lots of software on my Linux RedHat 8.0 server, among those is a Half-Life Server.

Now, when I start this server I type nohup in front of the name so that it won't shut down when I log off the SSH client, I don't know if nohup is needed but it works fine. Anyway, when I log back into the machine, of course the server is running in the background, vissible in "top" but not in PS, my question is:

Can I reactivate the process in some way so that I can type commands to the server from SSH without having to restart it, eneter the commands, and then send it to the background ?

Please advise,

Sebastian Andersson
Old 11-28-2005, 11:45 AM   #2
Registered: Oct 2005
Location: California
Distribution: SLED 10, openSuSE 10.2, Ubuntu Drapper
Posts: 713

Rep: Reputation: 30
Old 11-28-2005, 11:47 AM   #3
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,453
Blog Entries: 15

Rep: Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449
If you'd backgrounded it with bg you could use fg to foreground it. That's typically within the same terminal though. Since you logged out there's no guarantee you're on the same terminal (unless you're on the console or a serial terminal). You can do "man bash" for more details of fg if you want to try.

A way to do this though is to use the "screen" command. This is designed to allow you to start something making it independent of where you're logged in so that when you log out it is still running (good for things that do output to your terminal that don't like being backgrounded normally). You can later login on another terminal and access the screen that was previously started. I used this quite a bit up until about a year ago - haven't had much need recently.

Some of my notes about usage of "screen":

screen -list - Shows screen session names
screen -S <name> - Starts screen session and gives it <name> as name.
screen -x <pid> - Attaches to existing screen session with PID of <pid>.
screen -x <name> - Attaches to existing screen session named <name>.(This doesn't always work)
Ctrl-A - Main command to use within screen. Selected options:
Ctrl-A ? - Gives a list of all options
Ctrl-A 0 - Goes to first window within a screen session.
Ctrl-A 1 - Goes to second window within a screen session.
Ctrl-A <n> - Goes to nth window within a screen session.
Doing exit from within a screen session will fall back to previous window.
Doing exit from all windows in screen session will terminate screen.
Closing window that has a screen session will leave it running and detached.
Old 11-28-2005, 12:45 PM   #4
LQ Newbie
Registered: Sep 2003
Location: Ljunghusen, Sweden
Distribution: RH6, debian
Posts: 23

Original Poster
Rep: Reputation: 15
Thanks for the reply, Ill try it first thing tomorrow!


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
really background a process Henster Linux - Newbie 1 07-01-2005 05:29 AM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM
Background Process mojozoox Linux - General 1 08-26-2003 02:16 PM
Background process h8r Linux - Newbie 5 01-13-2003 04:21 PM
background process gurra Programming 9 09-30-2001 01:31 PM > Forums > Linux Forums > Linux - Newbie

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