- Update to version 1.0pre3
- Boxboro-EX enhancements - Bugfixes Minor pidfile handling adjusting in service file - Added missing conf file and trigger scripts OBS-URL: https://build.opensuse.org/package/show/Base:System/mcelog?expand=0&rev=11
This commit is contained in:
parent
ca30e6e939
commit
ab81bb9b4e
17
fix_cache_trigger.patch
Normal file
17
fix_cache_trigger.patch
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
triggers/cache-error-trigger | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: mcelog-1.0pre3/triggers/cache-error-trigger
|
||||
===================================================================
|
||||
--- mcelog-1.0pre3.orig/triggers/cache-error-trigger
|
||||
+++ mcelog-1.0pre3/triggers/cache-error-trigger
|
||||
@@ -25,7 +25,7 @@ for i in $CPUS_AFFECTED ; do
|
||||
logger -s -p daemon.crit -t mcelog "Offlining CPU $i due to cache error threshold"
|
||||
F=$(printf "/sys/devices/system/cpu/cpu%d/online" $i)
|
||||
echo 0 > $F
|
||||
- if [ "$(< $F)" != "0" ] then
|
||||
+ if [ "$(< $F)" != "0" ]; then
|
||||
logger -s -p daemon.warn -t mcelog "Offlining CPU $i failed"
|
||||
fi
|
||||
done
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 19 00:39:36 CET 2010 - ro@suse.de
|
||||
|
||||
- Update to version 1.0pre3
|
||||
- Boxboro-EX enhancements
|
||||
- Bugfixes
|
||||
Minor pidfile handling adjusting in service file
|
||||
- Added missing conf file and trigger scripts
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 3 12:12:40 CET 2009 - trenn@suse.de
|
||||
|
||||
|
@ -81,6 +81,17 @@ case "$1" in
|
||||
${kill}
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart)
|
||||
## Do a restart only if the service was active before.
|
||||
$0 status
|
||||
if test $? = 0; then
|
||||
$0 restart
|
||||
else
|
||||
rc_reset # Not running is not a failure.
|
||||
fi
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
reload|restart)
|
||||
/etc/init.d/mcelog stop
|
||||
/etc/init.d/mcelog start
|
||||
|
16
mcelog.spec
16
mcelog.spec
@ -28,6 +28,7 @@ ExclusiveArch: x86_64
|
||||
PreReq: %insserv_prereq
|
||||
Source: mcelog-%{version}.tar.bz2
|
||||
Source1: mcelog.service
|
||||
Patch1: fix_cache_trigger.patch
|
||||
Group: System/Monitoring
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -49,19 +50,19 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
make CFLAGS="$RPM_OPT_FLAGS"
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
export prefix=$RPM_BUILD_ROOT/usr
|
||||
export etcprefix=$RPM_BUILD_ROOT
|
||||
make -e install
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
||||
install -m755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/mcelog
|
||||
ln -s /etc/init.d/mcelog $RPM_BUILD_ROOT/usr/sbin/rcmcelog
|
||||
install -m755 mcelog $RPM_BUILD_ROOT/usr/sbin
|
||||
install -m644 mcelog.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
install -m644 mcelog.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/mcelog
|
||||
|
||||
%clean
|
||||
@ -73,10 +74,10 @@ if [ -c /dev/mcelog ];then
|
||||
fi
|
||||
|
||||
%preun
|
||||
%stop_on_removal mcelog
|
||||
%{stop_on_removal mcelog}
|
||||
|
||||
%postun
|
||||
%restart_on_update
|
||||
%{restart_on_update mcelog}
|
||||
%insserv_cleanup
|
||||
|
||||
%files
|
||||
@ -85,6 +86,9 @@ fi
|
||||
/usr/sbin/mcelog
|
||||
%config /etc/logrotate.d/mcelog
|
||||
/etc/init.d/mcelog
|
||||
%dir /etc/mcelog
|
||||
%config /etc/mcelog/mcelog.conf
|
||||
/etc/mcelog/*trigger
|
||||
/usr/sbin/rcmcelog
|
||||
|
||||
%changelog
|
||||
|
@ -1,85 +0,0 @@
|
||||
mcelog daemon: Add pid file handling
|
||||
|
||||
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
||||
|
||||
---
|
||||
mcelog.c | 41 +++++++++++++++++++++++++++++++++++++++--
|
||||
paths.h | 2 ++
|
||||
2 files changed, 41 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/mcelog.c b/mcelog.c
|
||||
index e166f57..a556664 100644
|
||||
--- a/mcelog.c
|
||||
+++ b/mcelog.c
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include <pwd.h>
|
||||
+#include <signal.h>
|
||||
+
|
||||
#include "mcelog.h"
|
||||
#include "paths.h"
|
||||
#include "k8.h"
|
||||
@@ -977,6 +979,37 @@ static void process_mcefd(struct pollfd *pfd, void *data)
|
||||
process(pfd->fd, d->recordlen, d->loglen, d->buf);
|
||||
}
|
||||
|
||||
+void exit_handler (int signal)
|
||||
+{
|
||||
+ remove(DAEMON_PID_PATH);
|
||||
+}
|
||||
+
|
||||
+static int daemonize(int foreground)
|
||||
+{
|
||||
+ int ret;
|
||||
+ pid_t pid;
|
||||
+ FILE *fd;
|
||||
+
|
||||
+ fd = fopen(DAEMON_PID_PATH, "r");
|
||||
+ if (!fd) {
|
||||
+ if (!foreground) {
|
||||
+ ret = daemon(0, need_stdout());
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ fd = fopen(DAEMON_PID_PATH, "w+");
|
||||
+ if (!fd)
|
||||
+ return -1;
|
||||
+ pid = getpid();
|
||||
+ fprintf(fd, "%d\n", pid);
|
||||
+ fclose(fd);
|
||||
+ signal(SIGKILL, exit_handler);
|
||||
+ signal(SIGTERM, exit_handler);
|
||||
+ return 0;
|
||||
+ } else
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
struct mcefd_data d = {};
|
||||
@@ -1031,8 +1064,12 @@ int main(int ac, char **av)
|
||||
page_setup();
|
||||
drop_cred();
|
||||
register_pollcb(fd, POLLIN, process_mcefd, &d);
|
||||
- if (!foreground && daemon(0, need_stdout()) < 0)
|
||||
- err("daemon");
|
||||
+ if (daemonize(foreground) < 0) {
|
||||
+ fprintf(stderr, "Could not run in background or create"
|
||||
+ " pidfile: " DAEMON_PID_PATH "\n");
|
||||
+ fprintf(stderr, "Is the daemon already running?\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
eventloop();
|
||||
} else {
|
||||
process(fd, d.recordlen, d.loglen, d.buf);
|
||||
diff --git a/paths.h b/paths.h
|
||||
index 6780552..efda627 100644
|
||||
--- a/paths.h
|
||||
+++ b/paths.h
|
||||
@@ -5,3 +5,5 @@
|
||||
#define CONFIG_FILENAME PREFIX "/etc/mcelog/mcelog.conf"
|
||||
|
||||
#define SOCKET_PATH "/var/run/mcelog-client"
|
||||
+
|
||||
+#define DAEMON_PID_PATH "/var/run/mcelog.pid"
|
Loading…
Reference in New Issue
Block a user