Logrotate is added. But more test is needed
This commit is contained in:
parent
6f5ec19388
commit
df1f35e92b
22
Makefile.am
22
Makefile.am
|
@ -2,7 +2,7 @@
|
|||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = lib src test support/systemd
|
||||
SUBDIRS = lib src support test
|
||||
|
||||
bin_PROGRAMS = nextepc-mmed nextepc-hssd nextepc-sgwd nextepc-pgwd nextepc-pcrfd nextepc-epcd
|
||||
|
||||
|
@ -34,26 +34,6 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/lib/core/include \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
sysconf_DATA = \
|
||||
support/nextepc.conf
|
||||
|
||||
freeDiameterdir = ${sysconfdir}/freeDiameter
|
||||
freeDiameter_DATA = \
|
||||
support/freeDiameter/mme.conf \
|
||||
support/freeDiameter/hss.conf \
|
||||
support/freeDiameter/pgw.conf \
|
||||
support/freeDiameter/pcrf.conf
|
||||
dist_freeDiameter_DATA = \
|
||||
support/freeDiameter/cacert.pem \
|
||||
support/freeDiameter/mme.key.pem \
|
||||
support/freeDiameter/mme.cert.pem \
|
||||
support/freeDiameter/hss.key.pem \
|
||||
support/freeDiameter/hss.cert.pem \
|
||||
support/freeDiameter/pgw.key.pem \
|
||||
support/freeDiameter/pgw.cert.pem \
|
||||
support/freeDiameter/pcrf.key.pem \
|
||||
support/freeDiameter/pcrf.cert.pem
|
||||
|
||||
install-data-hook:
|
||||
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/log
|
||||
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run
|
||||
|
|
18
acinclude.m4
18
acinclude.m4
|
@ -88,3 +88,21 @@ AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
|||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
|
||||
# adl_RECURSIVE_EVAL(VALUE, RESULT)
|
||||
# =================================
|
||||
# Interpolate the VALUE in loop until it doesn't change,
|
||||
# and set the result to $RESULT.
|
||||
# WARNING: It's easy to get an infinite loop with some unsane input.
|
||||
# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and
|
||||
# finally ${prefix} is replaced by the prefix.
|
||||
AC_DEFUN([adl_RECURSIVE_EVAL],
|
||||
[_lcl_receval="$1"
|
||||
$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
|
||||
_lcl_receval_old=''
|
||||
while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
|
||||
_lcl_receval_old="[$]_lcl_receval"
|
||||
eval _lcl_receval="\"[$]_lcl_receval\""
|
||||
done
|
||||
echo "[$]_lcl_receval")`])
|
||||
|
|
50
configure.ac
50
configure.ac
|
@ -189,23 +189,9 @@ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
|
|||
[`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\3/'`],
|
||||
[Patch version of this package])
|
||||
|
||||
# adl_RECURSIVE_EVAL(VALUE, RESULT)
|
||||
# =================================
|
||||
# Interpolate the VALUE in loop until it doesn't change,
|
||||
# and set the result to $RESULT.
|
||||
# WARNING: It's easy to get an infinite loop with some unsane input.
|
||||
# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and
|
||||
# finally ${prefix} is replaced by the prefix.
|
||||
AC_DEFUN([adl_RECURSIVE_EVAL],
|
||||
[_lcl_receval="$1"
|
||||
$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
|
||||
_lcl_receval_old=''
|
||||
while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
|
||||
_lcl_receval_old="[$]_lcl_receval"
|
||||
eval _lcl_receval="\"[$]_lcl_receval\""
|
||||
done
|
||||
echo "[$]_lcl_receval")`])
|
||||
##################################
|
||||
#### Checks for Directories. #####
|
||||
##################################
|
||||
|
||||
adl_RECURSIVE_EVAL(["${libdir}"], [LIB_DIR])
|
||||
adl_RECURSIVE_EVAL(["${sysconfdir}"], [SYSCONF_DIR])
|
||||
|
@ -237,6 +223,28 @@ AC_ARG_WITH(
|
|||
]
|
||||
)
|
||||
|
||||
case $host in
|
||||
*-apple-darwin*)
|
||||
;;
|
||||
*)
|
||||
AC_SUBST(logrotate_conf_dir)
|
||||
;;
|
||||
esac
|
||||
AC_ARG_WITH(
|
||||
logrotate-conf-dir,
|
||||
AS_HELP_STRING(
|
||||
[--with-logrotateconfdir=DIR],
|
||||
[logrotate conf directory @<:@LOGROTATE_CONF_DIR@:>@
|
||||
Defaults to the correct value for debian /etc/logrotate.d/]
|
||||
),
|
||||
[
|
||||
logrotate_conf_dir="$withval"
|
||||
],
|
||||
[
|
||||
logrotate_conf_dir="/etc/logrotate.d/"
|
||||
]
|
||||
)
|
||||
|
||||
##################################
|
||||
#### Checks for header files. ####
|
||||
##################################
|
||||
|
@ -497,14 +505,18 @@ AC_CONFIG_FILES([src/sgw/Makefile])
|
|||
AC_CONFIG_FILES([src/pgw/Makefile])
|
||||
AC_CONFIG_FILES([src/pcrf/Makefile])
|
||||
AC_CONFIG_FILES([src/Makefile])
|
||||
AC_CONFIG_FILES([test/Makefile])
|
||||
AC_CONFIG_FILES([support/nextepc.conf])
|
||||
AC_CONFIG_FILES([support/freeDiameter/mme.conf])
|
||||
AC_CONFIG_FILES([support/freeDiameter/hss.conf])
|
||||
AC_CONFIG_FILES([support/freeDiameter/pgw.conf])
|
||||
AC_CONFIG_FILES([support/freeDiameter/pcrf.conf])
|
||||
#AC_CONFIG_FILES([support/freeDiameter/dict_legacy_xml.conf])
|
||||
AC_CONFIG_FILES([support/freeDiameter/Makefile])
|
||||
AC_CONFIG_FILES([support/systemd/Makefile])
|
||||
AC_CONFIG_FILES([support/logrotate/nextepc])
|
||||
AC_CONFIG_FILES([support/logrotate/Makefile])
|
||||
AC_CONFIG_FILES([support/nextepc.conf])
|
||||
AC_CONFIG_FILES([support/Makefile])
|
||||
AC_CONFIG_FILES([test/Makefile])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
|
|
|
@ -93,7 +93,9 @@ int logger_start(const char *path)
|
|||
int ret, count = 0;
|
||||
size_t nbytes;
|
||||
ssize_t r;
|
||||
#if 0 /* deprecated by logrotate */
|
||||
file_info_t finfo;
|
||||
#endif
|
||||
int us;
|
||||
fd_set readfd;
|
||||
struct timeval timer_val;
|
||||
|
@ -195,6 +197,7 @@ int logger_start(const char *path)
|
|||
(long)r, (long)nbytes);
|
||||
}
|
||||
|
||||
#if 0 /* Deprecated by logrotate */
|
||||
if (count % FILE_CHECK_CYCLE == 0)
|
||||
{
|
||||
file_info_get(&finfo, FILE_INFO_SIZE, g_file);
|
||||
|
@ -203,6 +206,7 @@ int logger_start(const char *path)
|
|||
log_file_backup();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
count++;
|
||||
}
|
||||
|
|
1
main.c
1
main.c
|
@ -48,6 +48,7 @@ static int check_signal(int signum)
|
|||
}
|
||||
case SIGHUP:
|
||||
{
|
||||
d_info("SIGHUP received");
|
||||
logger_restart();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = freeDiameter systemd logrotate
|
||||
|
||||
sysconf_DATA = nextepc.conf
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
|
@ -0,0 +1,23 @@
|
|||
freeDiameterdir = ${sysconfdir}/freeDiameter
|
||||
|
||||
freeDiameter_DATA = \
|
||||
mme.conf \
|
||||
hss.conf \
|
||||
pgw.conf \
|
||||
pcrf.conf \
|
||||
$(NULL)
|
||||
|
||||
dist_freeDiameter_DATA = \
|
||||
cacert.pem \
|
||||
mme.key.pem \
|
||||
mme.cert.pem \
|
||||
hss.key.pem \
|
||||
hss.cert.pem \
|
||||
pgw.key.pem \
|
||||
pgw.cert.pem \
|
||||
pcrf.key.pem \
|
||||
pcrf.cert.pem \
|
||||
$(NULL)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
|
@ -0,0 +1,5 @@
|
|||
confdir = ${logrotate_conf_dir}
|
||||
conf_DATA = nextepc
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
|
@ -0,0 +1,15 @@
|
|||
@LOCALSTATE_DIR@/log/nextepc.log {
|
||||
daily
|
||||
sharedscripts
|
||||
missingok
|
||||
compress
|
||||
rotate 14
|
||||
|
||||
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`
|
||||
fi
|
||||
done
|
||||
endscript
|
||||
}
|
|
@ -11,3 +11,6 @@ unitdir = ${systemd_unit_dir}
|
|||
unit_DATA = $(unitfiles)
|
||||
|
||||
EXTRA_DIST = $(unitfiles)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
||||
|
|
Loading…
Reference in New Issue