Class: WEBrick::Daemon
- Inherits:
-
Object
- Object
- WEBrick::Daemon
- Defined in:
- lib/webrick/server.rb
Overview
A generic module for daemonizing a process
Class Method Summary collapse
-
.start ⇒ Object
Performs the standard operations for daemonizing a process.
Class Method Details
.start ⇒ Object
Performs the standard operations for daemonizing a process. Runs a block, if given.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/webrick/server.rb', line 35 def Daemon.start exit!(0) if fork Process::setsid exit!(0) if fork Dir::chdir("/") File::umask(0) STDIN.reopen("/dev/null") STDOUT.reopen("/dev/null", "w") STDERR.reopen("/dev/null", "w") yield if block_given? end |