diff options
author | 2002-01-26 15:23:31 +0000 | |
---|---|---|
committer | 2002-01-26 15:23:31 +0000 | |
commit | 1a455065abfbc601c41c992a94b77efbf3fd5f8b (patch) | |
tree | d453e2a00c5090855ef33f12065d4852925e6e3f /app-admin/metalog | |
parent | New version, removed old one (diff) | |
download | historical-1a455065abfbc601c41c992a94b77efbf3fd5f8b.tar.gz historical-1a455065abfbc601c41c992a94b77efbf3fd5f8b.tar.bz2 historical-1a455065abfbc601c41c992a94b77efbf3fd5f8b.zip |
added support for pid file
Diffstat (limited to 'app-admin/metalog')
-rw-r--r-- | app-admin/metalog/files/digest-metalog-0.6-r8 | 1 | ||||
-rw-r--r-- | app-admin/metalog/files/metalog-0.6-gentoo.patch | 107 | ||||
-rw-r--r-- | app-admin/metalog/files/metalog.rc6 | 9 | ||||
-rw-r--r-- | app-admin/metalog/metalog-0.6-r8.ebuild | 43 |
4 files changed, 157 insertions, 3 deletions
diff --git a/app-admin/metalog/files/digest-metalog-0.6-r8 b/app-admin/metalog/files/digest-metalog-0.6-r8 new file mode 100644 index 000000000000..98972742d42c --- /dev/null +++ b/app-admin/metalog/files/digest-metalog-0.6-r8 @@ -0,0 +1 @@ +MD5 67cdfc65a8820db7a6bdd35995dd9889 metalog-0.6.tar.gz 102400 diff --git a/app-admin/metalog/files/metalog-0.6-gentoo.patch b/app-admin/metalog/files/metalog-0.6-gentoo.patch new file mode 100644 index 000000000000..f3f5c9cf1c1c --- /dev/null +++ b/app-admin/metalog/files/metalog-0.6-gentoo.patch @@ -0,0 +1,107 @@ +diff -ru metalog-0.6/AUTHORS metalog-0.6.1/AUTHORS +--- metalog-0.6/AUTHORS 2001-06-25 17:08:40.000000000 -0400 ++++ metalog-0.6.1/AUTHORS 2002-01-26 07:16:44.000000000 -0500 +@@ -1 +1,2 @@ + Frank DENIS "Jedi/Sector One" <ange@angelic.com> ++Leo Lipelis <aeoo@gentoo.org> - tiny patch to allow /var/run/metalog.pid +diff -ru metalog-0.6/ChangeLog metalog-0.6.1/ChangeLog +--- metalog-0.6/ChangeLog 2001-07-09 10:27:55.000000000 -0400 ++++ metalog-0.6.1/ChangeLog 2002-01-26 07:16:44.000000000 -0500 +@@ -1,3 +1,5 @@ ++* Gentoo Patch : ++ Add --pidfile <opt> option to allow <opt> pid file creation. + * Version 0.6 : + Use strtoq if strtoull isn't available. + Read /dev/klog when klogctl() isn't implemented. +diff -ru metalog-0.6/src/metalog.c metalog-0.6.1/src/metalog.c +--- metalog-0.6/src/metalog.c 2001-07-09 10:23:16.000000000 -0400 ++++ metalog-0.6.1/src/metalog.c 2002-01-26 09:36:54.000000000 -0500 +@@ -868,6 +868,8 @@ + + static RETSIGTYPE sigkchld(int sig) + { ++ fprintf(stderr, "Unlinking pid file: %s\n", pid_file); ++ unlink(pid_file); + fprintf(stderr, "Process [%u] died with signal [%d]\n", + (unsigned int) getpid(), sig); + exit(EXIT_FAILURE); +@@ -974,6 +976,7 @@ + int fodder; + int option_index = 0; + ++ pid_file = NULL; + while ((fodder = getopt_long(argc, argv, GETOPT_OPTIONS, + long_options, &option_index)) != -1) { + switch (fodder) { +@@ -995,6 +998,13 @@ + case 's' : + synchronous = (sig_atomic_t) 1; + break; ++ case 'p' : ++ /* this is needed because argv will get nuked */ ++ pid_file = (char *) malloc(strlen(optarg) + 1); ++ if (pid_file != NULL) { ++ strcpy(pid_file, optarg); ++ } ++ break; + default : + fprintf(stderr, "Unknown option\n"); + exit(EXIT_FAILURE); +@@ -1010,6 +1020,16 @@ + } + } + ++static void writePidFile(const char *const pid_file) ++{ ++ FILE *f; ++ f = fopen(pid_file, "wb"); ++ if (f) { ++ fprintf(f, "%u\n", (u_int) getpid()); ++ fclose(f); ++ } ++} ++ + int main(int argc, char *argv[]) + { + int sockets[2]; +@@ -1025,6 +1045,10 @@ + } + dodaemonize(); + setsignals(); ++ /* write MASTER pid to /var/run/metalog.pid */ ++ if (pid_file) { ++ writePidFile(pid_file); ++ } + clearargs(argv); + setprogname(PROGNAME_MASTER); + if (getDataSources(sockets) < 0) { +diff -ru metalog-0.6/src/metalog_p.h metalog-0.6.1/src/metalog_p.h +--- metalog-0.6/src/metalog_p.h 2001-07-09 10:17:06.000000000 -0400 ++++ metalog-0.6.1/src/metalog_p.h 2002-01-26 07:16:44.000000000 -0500 +@@ -2,9 +2,9 @@ + #define __METALOG_P_H__ 1 + + #ifdef HAVE_KLOGCTL +-# define GETOPT_OPTIONS "Bc:hs" ++# define GETOPT_OPTIONS "Bc:hsp:" + #else +-# define GETOPT_OPTIONS "Bhs" ++# define GETOPT_OPTIONS "Bhsp:" + #endif + + static struct option long_options[] = { +@@ -14,6 +14,7 @@ + #endif + { "help", 0, NULL, 'h' }, + { "synchronous", 0, NULL, 's' }, ++ { "pidfile", 1, NULL, 'p' }, + { NULL, 0, NULL, 0 } + }; + +@@ -27,5 +28,6 @@ + static pid_t command_child; + static sig_atomic_t synchronous; + static signed char daemonize; ++static char *pid_file; + + #endif diff --git a/app-admin/metalog/files/metalog.rc6 b/app-admin/metalog/files/metalog.rc6 index fd5c4c264de5..9fa030dd6620 100644 --- a/app-admin/metalog/files/metalog.rc6 +++ b/app-admin/metalog/files/metalog.rc6 @@ -1,7 +1,9 @@ #!/sbin/runscript # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/app-admin/metalog/files/metalog.rc6,v 1.3 2001/12/06 20:17:01 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/metalog/files/metalog.rc6,v 1.4 2002/01/26 15:22:56 aeoo Exp $ + +METALOG_PID="/var/run/metalog.pid" depend() { need clock @@ -18,12 +20,13 @@ checkconfig() { start() { checkconfig || return 1 ebegin "Starting metalog" - start-stop-daemon --start --quiet --exec /usr/sbin/metalog -- -B + start-stop-daemon --start --quiet --exec /usr/sbin/metalog -- -B \ + -p ${METALOG_PID} eend $? } stop() { ebegin "Stopping metalog" - start-stop-daemon --stop --quiet --exec /usr/sbin/metalog + start-stop-daemon --stop --quiet --pidfile ${METALOG_PID} eend $? } diff --git a/app-admin/metalog/metalog-0.6-r8.ebuild b/app-admin/metalog/metalog-0.6-r8.ebuild new file mode 100644 index 000000000000..16eb69f161fb --- /dev/null +++ b/app-admin/metalog/metalog-0.6-r8.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2001 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Jerry A! <jerry@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/app-admin/metalog/metalog-0.6-r8.ebuild,v 1.1 2002/01/26 15:23:31 aeoo Exp $ + +GFILESDIR=${PORTDIR}/app-admin/metalog/files +S=${WORKDIR}/${P} +DESCRIPTION="A highly configurable replacement for syslogd/klogd" +SRC_URI="http://prdownloads.sourceforge.net/metalog/${P}.tar.gz" +HOMEPAGE="http://metalog.sourceforge.net/" + +DEPEND="virtual/glibc + >=dev-libs/libpcre-3.4" + + +src_unpack() { + unpack ${A} + cd ${WORKDIR} + cat ${GFILESDIR}/metalog-0.6-gentoo.patch | patch -p0 || die + cd ${S}/src + mv metalog.h metalog.h.orig + sed -e "s:/etc/metalog.conf:/etc/metalog/metalog.conf:g" \ + metalog.h.orig > metalog.h +} + +src_compile() { + ./configure --prefix=/usr --mandir=/usr/share/man || die + + emake || die +} + +src_install () { + make DESTDIR=${D} install || die + + insinto /etc/metalog + doins metalog.conf + + exeinto /etc/init.d + newexe ${FILESDIR}/metalog.rc6 metalog + + dodoc AUTHORS COPYING ChangeLog README + newdoc metalog.conf metalog.conf.sample +} |