make commands keep running after leaving a terminal session or ssh session
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
make commands keep running after leaving a terminal session or ssh session
I am trying to write a c++ code where i can run 3 parallel jobs via multithreading and want them to be alive even if i kill the terminal..But when ever i kill the terminal,the job also gets killed.Can i know how to do so?
Thanks in advance.
Yeah i know about the & operator but even if i am using it my code is not working.If i kill the terminal,my application also exits.
Lets say m trying to launch xlogo.so even if am using command : xlogo &. Then if i terminate the execution, xlogo goes in background.thats ok.but if i kill my terminal,then the xlogo is also killed but i want it to be alive.. So is there any way out so that i can keep my xlogo thing alive??
It was way too complicated for me to understand. Can you explain me out in simple code example?
Or else i might show you my code over here.You check it and tell me where i m committing a mistake.
Yeah am trying to use nohup only.
I am using it lyk nohup xlogo & but killing the terminal also kills the xlogo..
How are you "killing" the terminal?
If I run xlogo in the background, from a terminal, and exit the terminal gracefully (ie. exit or ctrl-d), then it keeps running.
If I kill the terminal using the X widget, then xlogo exits too. However, if I run xlogo using nohup, then it keeps running.
The title of your post indicated that you may also want to run xlogo via an SSH session, and I presume to keep it running even after the session has terminated. I do not believe this is possible, since it is SSH that is managing the port-forwarding of data, not the X11 server.
P.S. A little advice... when asking for help on this forum, continually requesting immediate help may actually dissuade other members from helping you. Always be patient. Sometimes it may take a day for someone to respond to your query.
Last edited by dwhitney67; 01-27-2012 at 06:06 AM.
It was way too complicated for me to understand. Can you explain me out in simple code example?
Or else i might show you my code over here.You check it and tell me where i m committing a mistake.
You posted back only 8 minutes after the reply to your question. How much can you possibly have tried in such a brief time? You do have to put in a little effort.
--- rod.
Distribution: openSuSE, Fedora, CentOS, Debian,, and others
Posts: 84
Rep:
I would have to agree with firstfire in regards to your question. I use screen every day at work to run multiple tasks and when I exit the machine after detaching the screen session the task continues to run until completion.
To exit screen use the following key sequence: CNTL+A+D then to return to your screen session (if only 1) use screen -x you will see that the task continues to run even if you disconnect from ssh. To exit screen just type exit.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.