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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have recently registered for a free shell account so that i can use it to test C Programs from any Windows PC using the net. Now the problem is that i have made a server program which needs to run in the background, but when i try doing that using & its not working,the program starts running and even pressing Ctrl+Z it wont go to the background! Any idea whats wrong?
You need a space between the prog name and the '&'.
Using nohup as well ensures it'll keep running if you logout, otherwise it's still 'attached' to your terminal, even though it's in background mode.
IOW, do as per kotnik's example
Have you tried forking the program? I'm not sure if that's the proper terminology, as I'm not a C or C++ programmer. The method I'm referring to goes like this:
1. Start Program1.
2. Spawn a child process for the main algorithm.
3. The parent process dies, as it is finished, and the child process does what it's supposed to do.
ok this is whats happeneing:
When i run the program with this command: ./ProgramObject<SPACE>& the program starts running on screen and does not go to the background even by pressing Ctrl+Z. And using nohup also does not make any difference.
But the program is running fine in my college PC which runs Linux. So is the problem with my Shell Account?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.