Difference between revisions of "HowTo Keep Processes Running After Logging Out Using: "setsid""
From NST Wiki
Jump to navigationJump to search (→HowTo Set Session ID (SID) and Process Group ID (PGID)) |
(→HowTo Set The Session ID (SID) and Process Group ID (PGID)) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | == HowTo Set Session ID (SID) and Process Group ID (PGID) == | + | == HowTo Set The Session ID (SID) and Process Group ID (PGID) == |
− | The "'''setsid'''" command allows one to set a new "'''Session ID'''" ('''SID''') and "'''Process Group ID'''" ('''PGID''') for a given command. This can be useful when logging out from a '''shell''' environment and keeping a process running. Since the process is <u>running</u> in an entirely different "'''session'''", it should <u>not</u> be effected by | + | The "'''setsid'''" command allows one to set a new "'''Session ID'''" ('''SID''') and "'''Process Group ID'''" ('''PGID''') for a given command. This can be quite <u>useful</u> when logging out from a '''shell''' environment and keeping a process up and running. Since the process is <u>running</u> in an entirely different "'''session'''", it should <u>not</u> be effected by the log out and '''shell''' termination sequence. |
+ | |||
<div class="screen"> | <div class="screen"> | ||
− | <div class="screenTitle">''Command:'' "setsig" Example: Keep The "Find" Command Running After Logging Out.</div> | + | <div class="screenTitle">''Command:'' "setsig" Example: Keep The "Find" Command Running After Logging Out.</div> |
− | <div class="userInput"><span class="prompt">[root@probe tmp]# </span><nowiki>setsid find / -name "rmsession.log" >| /tmp/findresults &</nowiki></div> | + | <div class="userInput"><span class="prompt">[root@probe tmp]# </span><nowiki>setsid find / -name "rmsession.log" >| "/tmp/findresults" &</nowiki></div> |
+ | <div class="userInput"><span class="prompt">[root@probe tmp]# </span><nowiki>exit</nowiki></div> | ||
</div> | </div> | ||
+ | |||
+ | One can also use the "'''nohup'''", "'''disown'''" and "'''screen'''" commands to provide similar results. |
Latest revision as of 08:55, 30 November 2007
HowTo Set The Session ID (SID) and Process Group ID (PGID)
The "setsid" command allows one to set a new "Session ID" (SID) and "Process Group ID" (PGID) for a given command. This can be quite useful when logging out from a shell environment and keeping a process up and running. Since the process is running in an entirely different "session", it should not be effected by the log out and shell termination sequence.
Command: "setsig" Example: Keep The "Find" Command Running After Logging Out.
[root@probe tmp]# setsid find / -name "rmsession.log" >| "/tmp/findresults" &
[root@probe tmp]# exit
One can also use the "nohup", "disown" and "screen" commands to provide similar results.