Advertisement

setsid & nohup?

Started by April 09, 2004 01:44 PM
5 comments, last by Luctus 20 years, 5 months ago
I recently "found" those commands and from reading their man-pages, it sounds like they could have some pretty good uses. Anyone know what they are generally used for? maybe got some nifty trick using them? -Luctus Statisticly seen, most things happens to other people. [Mail]
-LuctusIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move - Douglas Adams
Basically, jsut keeping things running after you log out.

nothing special.
Advertisement
As an example, you ssh into your computer, and want to start downloading a large file without having to keep the connection open. Run nohup wget url &, close your ssh connection, and it keeps downloading.
A related question, lets say I''ve started a process and I want to log out without terminating the process. Is there a way to use nohup, or something similar, on an already running process?

Thanks.
Kevin.
quote: Original post by Krumble
A related question, lets say I''ve started a process and I want to log out without terminating the process. Is there a way to use nohup, or something similar, on an already running process?

Not as far as I know. When you log out, any processes attached to that session get sent SIGHUP, which by default terminates them. nohup basically works by spawning a process and ignoring SIGHUP. So if you''ve started a program ''normally'', it''ll quit when you close your session.

If your process is something like wget, though, you could interrupt it, and then restart it inside of nohup with the right command-line arguments to resume what it was doing last.
> A related question, lets say I''ve started a process and I want to log out without terminating the process. Is there a way to use nohup, or something similar, on an already running process?

If you''re using bash, you can "disown" a job. If something is running in the foreground, stop it with ctrl-z, continue it in the background with "bg", and then "disown". Once you''ve disowned a job you can end the shell without sending HUP to the job''s process.
Advertisement
if you are using a remote login like SSH to work you can use ''screen''. one started you get, besides many virtual terminals on one terminal, the possibility to detach the screen session (using CTRL+A,D) and you can resume it later using ''screen -r''. otherwise nohup is your friend ^_^

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

This topic is closed to new replies.

Advertisement