Crate daemonize [] [src]

daemonize is a library for writing system daemons. Inspired by the Python library thesharp/daemonize.

The documentation is located at http://knsd.github.io/daemonize/.

Usage example:

#[macro_use] extern crate log;
extern crate daemonize;

use daemonize::{Daemonize};

fn main() {
    let daemonize = Daemonize::new().pid_file("/tmp/test.pid")
                                    .chown_pid_file(true)
                                    .working_directory("/tmp")
                                    .user("nobody")
                                    .group("daemon") // Group name
                                    .group(2) // Or group id
                                    .privileged_action(|| "Executed before drop privileges");
     match daemonize.start() {
         Ok(_) => info!("Success, daemonized"),
         Err(e) => error!("{}", e),
     }
 }

Structs

Daemonize

Daemonization options.

Enums

DaemonizeError

This error type for Daemonize start method.

Group

Expects system group id or name. If name is provided it will be resolved to id later.

User

Expects system user id or name. If name is provided it will be resolved to id later.

Type Definitions

Errno
gid_t
uid_t