Library for writing system daemons http://knsd.github.io/daemonize/
Find a file
2017-01-12 09:39:09 +13:00
examples Add support for setting a different umask 2016-08-29 08:02:30 +02:00
src Merge remote-tracking branch 'upstream/master' 2017-01-12 09:39:09 +13:00
tests Add support for setting a different umask 2016-08-29 08:02:30 +02:00
.gitignore Add tests 2015-12-19 19:55:53 +03:00
.travis.yml Add coveralls support 2015-12-20 05:52:55 +03:00
Cargo.toml Bump version & update changelog 2016-08-29 23:26:28 +03:00
CHANGELOG.md Bump version & update changelog 2016-08-29 23:26:28 +03:00
LICENSE-APACHE Relicense under dual MIT/Apache-2.0 2016-01-10 12:47:43 +03:00
LICENSE-MIT Relicense under dual MIT/Apache-2.0 2016-01-10 12:47:43 +03:00
README.md docs: add umask usage to examples 2016-10-04 20:34:04 +03:00

daemonize Build Status Latest Version

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") // Every method except `new` and `start`
        .chown_pid_file(true)      // is optional, see `Daemonize` documentation
        .working_directory("/tmp") // for default behaviour.
        .user("nobody")
        .group("daemon") // Group name
        .group(2)        // or group id.
        .umask(0o777)    // Set umask, `0o027` by default.
        .privileged_action(|| "Executed before drop privileges");

     match daemonize.start() {
         Ok(_) => info!("Success, daemonized"),
         Err(e) => error!("{}", e),
     }
 }

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.