Struct daemonize::Daemonize [] [src]

pub struct Daemonize<T> { /* fields omitted */ }

Daemonization options.

Fork the process in the background, disassociate from its process group and the control terminal. Change umask value to 0o027, redirect all standard streams to /dev/null. Change working directory to / or provided value.

Optionally:

  • maintain and lock the pid-file;
  • drop user privileges;
  • drop group privileges;
  • change the pid-file ownership to provided user (and/or) group;
  • execute any provided action just before dropping privileges.

Methods

impl Daemonize<()>
[src]

impl<T> Daemonize<T>
[src]

Create pid-file at path, lock it exclusive and write daemon pid.

If chown is true, daemonize will change the pid-file ownership, if user or group are provided

Change working directory to path or / by default.

Drop privileges to user.

Drop privileges to group.

Change umask to mask or 0o027 by default.

Execute action just before dropping privileges. Most common usecase is to open listening socket. Result of action execution will be returned by start method.

Start daemonization process.

Trait Implementations

impl<T> Debug for Daemonize<T>
[src]

Formats the value using the given formatter.