Function Daemon::daemonize(std::string, std::string, std::string, std::string, std::string, bool)

Function Documentation

int Daemon::daemonize(std::string name, std::string path, std::string outfile, std::string errfile, std::string infile, bool closefd)

this function will daemonize a process

This function is overloaded

This version accepts a boolean to indicate if all file descriptors should be closed (true) or not (false). Some applications (E.G. Andor camera) can’t handle having all file descriptors closed, so setting this to false will cause only stdin, stdout, and stderr to be closed.

Parameters:
  • name[in] the name for this daemon

  • path[in] directory to chdir to when running daemon

  • outfile[in] where to direct stdout, /dev/null by default

  • errfile[in] where to direct stderr, /dev/null by default

  • infile[in] stdin, /dev/null by default

  • closefd[in] set true to close all file descriptors

Returns:

0