logrotate is now working.

This commit is contained in:
Sukchan Lee 2017-10-24 20:52:58 +09:00
parent 6989a8ae91
commit 0897c36947
5 changed files with 20 additions and 10 deletions

View File

@ -35,8 +35,10 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src
install-data-hook:
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/log
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/log/nextepc
chown $(current_user):$(current_group) $(DESTDIR)/$(localstatedir)/log/nextepc
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc
chown $(current_user):$(current_group) $(DESTDIR)/$(localstatedir)/run/nextepc
CLEANFILES = symtbl.c
DISTCLEANFILES = $(DIST_ARCHIVES)

View File

@ -463,6 +463,14 @@ LIBS="$LIBS $MONGOC_LIBS"
FREEDIAMETER_DIR=freeDiameter-1.2.1
AC_SUBST(FREEDIAMETER_DIR)
#####################
#### Misc. ####
#####################
current_user=`id -u -n`
AC_SUBST(current_user)
current_group=`id -g -n`
AC_SUBST(current_group)
#####################
#### Conclusion. ####
#####################

View File

@ -9,7 +9,7 @@
#include "app.h"
#define DEFAULT_PID_DIR_PATH LOCALSTATE_DIR "run/"
#define DEFAULT_PID_DIR_PATH LOCALSTATE_DIR "run/nextepc/"
static thread_id logger_thread = 0;
static void *THREAD_FUNC logger_main(thread_id id, void *data);
@ -122,8 +122,7 @@ status_t app_log_pid(const char *name)
d_assert(name, return CORE_ERROR, );
snprintf(fname, sizeof(fname), "%snextepc-%sd.pid",
DEFAULT_PID_DIR_PATH, name);
snprintf(fname, sizeof(fname), "%s%sd.pid", DEFAULT_PID_DIR_PATH, name);
mypid = getpid();
if (mypid != saved_pid
&& file_stat(&finfo, fname, FILE_INFO_MTIME) == CORE_OK)

View File

@ -1,14 +1,15 @@
@LOCALSTATE_DIR@/log/nextepc.log {
@LOCALSTATE_DIR@/log/nextepc/*.log {
daily
sharedscripts
missingok
compress
rotate 14
create 640 @current_user@ @current_group@
postrotate
for i in nextepc-pcrfd nextepc-pgwd nextepc-sgwd nextepc-hssd nextepc-mmed nextepc-epcd; do
if [ -e @LOCALSTATE_DIR@/run/$i.pid ] ; then
kill -HUP `cat @LOCALSTATE_DIR@/run/$i.pid`
for i in pcrfd pgwd sgwd hssd mmed epcd; do
if [ -e @LOCALSTATE_DIR@/run/nextepc/$i.pid ] ; then
kill -HUP `cat @LOCALSTATE_DIR@/run/nextepc/$i.pid`
fi
done
endscript

View File

@ -1,6 +1,6 @@
{
DB_URI : "mongodb://localhost/nextepc",
LOG_PATH : "@LOCALSTATE_DIR@/log/nextepc.log",
LOG_PATH : "@LOCALSTATE_DIR@/log/nextepc/nextepc.log",
TRACE:
{
S1AP: 1,