daemonize() is not responsible for loggers
This commit is contained in:
parent
870e5a8e26
commit
829a768e82
@ -4,7 +4,7 @@
|
|||||||
cryptopp/cryptopp: 9
|
cryptopp/cryptopp: 9
|
||||||
google/gmock: 4
|
google/gmock: 4
|
||||||
google/gtest: 11
|
google/gtest: 11
|
||||||
messmer/cmake: 4
|
messmer/cmake: 3
|
||||||
messmer/spdlog: 0
|
messmer/spdlog: 0
|
||||||
|
|
||||||
[parent]
|
[parent]
|
||||||
|
@ -18,7 +18,7 @@ namespace cpputils {
|
|||||||
|
|
||||||
//TODO Test daemonize()
|
//TODO Test daemonize()
|
||||||
|
|
||||||
void daemonize(const std::string &daemonName) {
|
void daemonize() {
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -44,9 +44,6 @@ namespace cpputils {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup logging to syslog.
|
|
||||||
cpputils::logging::setLogger(spdlog::syslog_logger(daemonName, daemonName, LOG_PID));
|
|
||||||
|
|
||||||
// Close out the standard file descriptors. The daemon can't use them anyhow.
|
// Close out the standard file descriptors. The daemon can't use them anyhow.
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
close(STDOUT_FILENO);
|
close(STDOUT_FILENO);
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
#ifndef MESSMER_CPPUTILS_DAEMON_DAEMONIZE_H
|
#ifndef MESSMER_CPPUTILS_DAEMON_DAEMONIZE_H
|
||||||
#define MESSMER_CPPUTILS_DAEMON_DAEMONIZE_H
|
#define MESSMER_CPPUTILS_DAEMON_DAEMONIZE_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace cpputils {
|
namespace cpputils {
|
||||||
void daemonize(const std::string &daemonName);
|
void daemonize();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user