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. |
Use the & after the program command.
example: Code:
$conky & Regards |
Hi -
To run a program in the background so you can exit the terminal, use "nohup": Code:
nohup myprog & |
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?? |
Yeah am trying to use nohup only.
I am using it lyk nohup xlogo & but killing the terminal also kills the xlogo.. |
You have to use a daemonization double-fork WITHIN the application.
This is an example: https://github.com/jgshort/Narcissis...c_daemonizer.c Use Google to find LOTS of similar snippets. |
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. |
Can somebody please reply to my question??
|
I am not able to continue running xlogo if i kill my terminal.Can anybody please tell me what am i missing in my code?
|
is there nobody who can help me over this??
|
?????
|
Quote:
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. |
|
Quote:
--- rod. |
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.
and example: Code:
[warezwaldo@m0b1l3 ~]$ screen |
All times are GMT -5. The time now is 06:36 PM. |