/[smeserver]/rpms/e-smith-lib/sme7/e-smith-lib-1.18.0-logfile_rotation.patch
ViewVC logotype

Contents of /rpms/e-smith-lib/sme7/e-smith-lib-1.18.0-logfile_rotation.patch

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


Revision 1.2 - (show annotations) (download)
Tue Oct 7 18:41:09 2008 UTC (16 years, 1 month ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
New streams

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-lib-1.18.0/root/etc/e-smith/events/actions/generic_template_expand mezzanine_patched_e-smith-lib-1.18.0/root/etc/e-smith/events/actions/generic_template_expand
2 --- e-smith-lib-1.18.0/root/etc/e-smith/events/actions/generic_template_expand 2006-02-16 22:52:14.000000000 -0500
3 +++ mezzanine_patched_e-smith-lib-1.18.0/root/etc/e-smith/events/actions/generic_template_expand 2007-03-26 15:47:50.000000000 -0400
4 @@ -1,6 +1,6 @@
5 #! /usr/bin/perl -w
6 #----------------------------------------------------------------------
7 -# copyright (C) 2003 Mitel Networks Corporation
8 +# copyright (C) 2003-2007 Mitel Networks Corporation
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 @@ -16,8 +16,6 @@
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 #
16 -# Technical support for this program is available from Mitel Networks
17 -# Please visit our web site www.mitel.com/sme/ for details.
18 #----------------------------------------------------------------------
19
20 use strict;
21 @@ -25,7 +23,6 @@
22 use File::Copy;
23 use esmith::templates;
24
25 -sub setup_logfile_symlink;
26 sub expand;
27
28 my $event = shift or die "Event name is required\n";
29 @@ -36,20 +33,6 @@
30 my $templates_dir = "/etc/e-smith/events/$event/templates2expand";
31 exit 0 unless -d $templates_dir;
32
33 -my $logfile_dir = "/etc/e-smith/events/$event/logfiles2timestamp";
34 -if (-d $logfile_dir)
35 -{
36 - # Prepare log rotation if required
37 - chdir $logfile_dir or die "Could not chdir to $logfile_dir: $!\n";;
38 - find({
39 - no_chdir => 1,
40 - follow => 0,
41 - wanted => \&setup_logfile_symlink,
42 - },
43 - '.'
44 - );
45 -}
46 -
47 chdir $templates_dir or die "Could not chdir to $templates_dir: $!\n";;
48 # Walk the tree and expand all templates referenced thereunder.
49 find({
50 @@ -62,39 +45,6 @@
51
52 exit 0;
53
54 -sub setup_logfile_symlink
55 -{
56 - return unless -f $_;
57 - s/^\.//;
58 - $filename = $_;
59 -
60 - # Set up filenames to be used by syslog. We first set up symlinks
61 - # with known names, then use the value of the symlink when we
62 - # expand the configuration files
63 - my $time = time();
64 -
65 - if (-f "${filename}" and ! -l "${filename}")
66 - {
67 - my ($sec,$min,$hour,$mday,$mon,$year) = localtime($time - 1);
68 - my $target = sprintf("%s.%04d%02d%02d%02d%02d%02d",
69 - $filename, $year+1900, $mon+1, $mday, $hour, $min, $sec);
70 - move("${filename}", "${target}") or
71 - die "Could not move ${filename} to " .
72 - "${target}";
73 - }
74 - my ($sec,$min,$hour,$mday,$mon,$year) = localtime($time);
75 - my $target = sprintf("%s.%04d%02d%02d%02d%02d%02d",
76 - $filename, $year+1900, $mon+1, $mday, $hour, $min, $sec);
77 -
78 - if (-l "${filename}")
79 - {
80 - unlink("${filename}") or
81 - warn "Could not unlink ${filename}";
82 - }
83 - symlink("${target}", "${filename}") or
84 - warn "Could not symlink ${target} to ${filename}";
85 -}
86 -
87 sub expand
88 {
89 return unless -f $_;

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