/[smeserver]/rpms/e-smith-base/sme8/e-smith-base-4.18.0-logfile_rotation.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme8/e-smith-base-4.18.0-logfile_rotation.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Jun 12 18:30:35 2007 UTC (17 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: e-smith-base-4_18_0-58_el5_sme, e-smith-base-4_18_0-89_el5_sme, e-smith-base-4_18_0-82_el5_sme, e-smith-base-4_18_0-67_el5_sme, e-smith-base-4_18_0-88_el5_sme, e-smith-base-4_18_0-87_el5_sme, e-smith-base-4_18_0-77_el5_sme, e-smith-base-4_18_0-69_el5_sme, e-smith-base-4_18_0-81_el5_sme, e-smith-base-4_18_0-100_el5_sme, e-smith-base-4_18_0-72_el5_sme, e-smith-base-4_18_0-62_el5_sme, e-smith-base-4_18_0-61_el5_sme, e-smith-base-4_18_0-78_el5_sme, e-smith-base-4_18_0-60_el5_sme, e-smith-base-4_18_0-94_el5_sme, e-smith-base-4_18_0-66_el5_sme, e-smith-base-4_18_0-83_el5_sme, e-smith-base-4_18_0-59_el5_sme, e-smith-base-4_18_0-63_el5_sme, e-smith-base-4_18_0-92_el5_sme, e-smith-base-4_18_0-64_el5_sme, e-smith-base-4_18_0-101_el5_sme, e-smith-base-4_18_0-98_el5_sme, e-smith-base-4_18_0-102_el5_sme, e-smith-base-4_18_0-90_el5_sme, e-smith-base-4_18_0-104_el5_sme, e-smith-base-4_18_0-71_el5_sme, e-smith-base-4_18_0-103_el5_sme, e-smith-base-4_18_0-99_el5_sme, e-smith-base-4_18_0-73_el5_sme, e-smith-base-4_18_0-79_el5_sme, e-smith-base-4_18_0-75_el5_sme, e-smith-base-4_18_0-76_el5_sme
Import on branch sme8 of package e-smith-base-4.18.0-58.el5.sme.src.rpm

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-base-4.18.0/createlinks mezzanine_patched_e-smith-base-4.18.0/createlinks
2 --- e-smith-base-4.18.0/createlinks 2007-03-26 16:11:58.000000000 -0400
3 +++ mezzanine_patched_e-smith-base-4.18.0/createlinks 2007-03-26 16:11:34.000000000 -0400
4 @@ -371,6 +371,7 @@
5
6 $event = "post-install";
7
8 +event_link("rotate_timestamped_logfiles", $event, "05");
9 event_link("init-accounts", $event, "05");
10 event_link("init-passwords", $event, "10");
11 event_link("conf-startup", $event, "10");
12 @@ -383,6 +384,7 @@
13
14 $event = "post-upgrade";
15
16 +event_link("rotate_timestamped_logfiles", $event, "05");
17 event_link("init-accounts", $event, "05");
18 event_link("conf-startup", $event, "10");
19 event_link("user-lock-passwd", $event, "15");
20 @@ -491,6 +493,7 @@
21
22 $event = "logrotate";
23
24 +event_link("rotate_timestamped_logfiles", $event, "05");
25 event_link("purge-old-logs", $event, "75");
26
27 safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/syslog");
28 diff -Nur -x '*.orig' -x '*.rej' e-smith-base-4.18.0/root/etc/e-smith/events/actions/rotate_timestamped_logfiles mezzanine_patched_e-smith-base-4.18.0/root/etc/e-smith/events/actions/rotate_timestamped_logfiles
29 --- e-smith-base-4.18.0/root/etc/e-smith/events/actions/rotate_timestamped_logfiles 1969-12-31 19:00:00.000000000 -0500
30 +++ mezzanine_patched_e-smith-base-4.18.0/root/etc/e-smith/events/actions/rotate_timestamped_logfiles 2007-03-26 15:50:34.000000000 -0400
31 @@ -0,0 +1,76 @@
32 +#! /usr/bin/perl -w
33 +#----------------------------------------------------------------------
34 +# copyright (C) 2003-2007 Mitel Networks Corporation
35 +#
36 +# This program is free software; you can redistribute it and/or modify
37 +# it under the terms of the GNU General Public License as published by
38 +# the Free Software Foundation; either version 2 of the License, or
39 +# (at your option) any later version.
40 +#
41 +# This program is distributed in the hope that it will be useful,
42 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
43 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 +# GNU General Public License for more details.
45 +#
46 +# You should have received a copy of the GNU General Public License
47 +# along with this program; if not, write to the Free Software
48 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
49 +#
50 +#----------------------------------------------------------------------
51 +
52 +use strict;
53 +use File::Find;
54 +use File::Copy;
55 +
56 +sub setup_logfile_symlink;
57 +
58 +my $event = shift or die "Event name is required\n";
59 +
60 +my $logfile_dir = "/etc/e-smith/events/$event/logfiles2timestamp";
61 +if (-d $logfile_dir)
62 +{
63 + # Prepare log rotation if required
64 + chdir $logfile_dir or die "Could not chdir to $logfile_dir: $!\n";;
65 + find({
66 + no_chdir => 1,
67 + follow => 0,
68 + wanted => \&setup_logfile_symlink,
69 + },
70 + '.'
71 + );
72 +}
73 +
74 +exit 0;
75 +
76 +sub setup_logfile_symlink
77 +{
78 + return unless -f $_;
79 + s/^\.//;
80 + my $filename = $_;
81 +
82 + # Set up filenames to be used by syslog. We first set up symlinks
83 + # with known names, then use the value of the symlink when we
84 + # expand the configuration files
85 + my $time = time();
86 +
87 + if (-f "${filename}" and ! -l "${filename}")
88 + {
89 + my ($sec,$min,$hour,$mday,$mon,$year) = localtime($time - 1);
90 + my $target = sprintf("%s.%04d%02d%02d%02d%02d%02d",
91 + $filename, $year+1900, $mon+1, $mday, $hour, $min, $sec);
92 + move("${filename}", "${target}") or
93 + die "Could not move ${filename} to " .
94 + "${target}";
95 + }
96 + my ($sec,$min,$hour,$mday,$mon,$year) = localtime($time);
97 + my $target = sprintf("%s.%04d%02d%02d%02d%02d%02d",
98 + $filename, $year+1900, $mon+1, $mday, $hour, $min, $sec);
99 +
100 + if (-l "${filename}")
101 + {
102 + unlink("${filename}") or
103 + warn "Could not unlink ${filename}";
104 + }
105 + symlink("${target}", "${filename}") or
106 + warn "Could not symlink ${target} to ${filename}";
107 +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed