Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
When I start a process and then send it to bg using Ctrl+Z, it is stopped, right? To resume I use the bg command, right?
Imagine I'm in a remote ssh session, I start a process and want to send it to bg so that I can logout and leave the process running. How can I do that? And how can I see the results when I login again?
check out 'rpmfind.net' a valuable resource for any rpm based distro.
screen, just as background, works as a 'virtual shell', i guess. You run screen, it opens up a new shell and continues running that shell until you explicity kill it. You can jump into or out of that shell at any time.
Putting an ampersand -&- behind any command makes it immediately go into the background. However, if the command wants to write to it's controlling terminal then it will simply stop until you bring it to the foreground again. Using 'nohup' will let it continue in the background in the absence of a controlling terminal and will also prevent it from exiting when it gets the 'HUP' signal when you log out.
If the command doesn't need to print anything to the terminal then it may just continue to run in the bakground even after you log out without the nohup command; it all depends on what the program does when it receives a 'HUP' signal. Some programs ignore it, some quit.
It depends on the process. When you logout, all processes are sent a HUP signal, but it's up to the process to decide what to do with it. Some exit, some continue running. Most daemon-type processes simply reload their configuration settings when they receive a HUP.
Also, if you background a process and leave it running on one terminal, you can't bring it forward on another unless you were using the 'screen' app mentioned earlier.
I hope my post is as relevant to this thread as I feel it is..
I'm having much the same problem/situation since I also want to get a process running in the background..
I have an Openvpn-process that I've tried to startup as an backgroundprocess.
I want to be able to start it via remote ssh and then logout again.
I've tried to execute the original command with it's required options and then ended it with an ampersand. Although, this command requires input of login & passwd after execution, but when I end the command with an "&" it simply skips this login/passwd part and then the process doesn't start up properly..
If I simply start it by it's usuall command I can't exit the shell and logout since when I do a Ctrl+C it shuts down the process..
Hopefully someone else's been through this who could help me out..
If the issue you're having is just not getting a password prompt when you attempt to run the command, there's this nice little property about sudo... it sticks around. If you have to put in a sudo password for a command, your next several sudo commands don't need a password. So just before you run the command, do something like
and that gets you your sudo, you run the sudo nohup [command] & and you're good to go.