use SIGHUP for reopening log file
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/var/log/ebusd.log {
|
/var/log/ebusd*.log {
|
||||||
rotate 7
|
rotate 7
|
||||||
size 1M
|
size 1M
|
||||||
copytruncate
|
copytruncate
|
||||||
@@ -6,4 +6,6 @@
|
|||||||
missingok
|
missingok
|
||||||
notifempty
|
notifempty
|
||||||
daily
|
daily
|
||||||
|
postrotate
|
||||||
|
/usr/bin/killall -HUP ebusd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -590,6 +590,10 @@ void signalHandler(int sig) {
|
|||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
logNotice(lf_main, "SIGHUP received");
|
logNotice(lf_main, "SIGHUP received");
|
||||||
|
if (!opt.foreground) {
|
||||||
|
closeLogFile();
|
||||||
|
setLogFile(opt.logFile);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
logNotice(lf_main, "SIGINT received");
|
logNotice(lf_main, "SIGINT received");
|
||||||
|
|||||||
@@ -141,6 +141,9 @@ bool needsLog(const LogFacility facility, const LogLevel level) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void logWrite(const char* facility, const char* level, const char* message, va_list ap) {
|
void logWrite(const char* facility, const char* level, const char* message, va_list ap) {
|
||||||
|
if (s_logFile == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct tm td;
|
struct tm td;
|
||||||
clockGettime(&ts);
|
clockGettime(&ts);
|
||||||
|
|||||||
Reference in New Issue
Block a user