/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.1-bz11950-symlinked-logs.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme10/e-smith-base-5.8.1-bz11950-symlinked-logs.patch

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


Revision 1.3 - (hide annotations) (download)
Sun Apr 17 04:00:17 2022 UTC (2 years, 7 months ago) by jpp
Branch: MAIN
CVS Tags: e-smith-base-5_8_1-13_el7_sme
Changes since 1.2: +3 -2 lines
* Sat Apr 16 2022 Jean-Philippe Pialasse <tests@pialasse.com> 5.8.1-13.sme
- fix symlinks preventing log rotation [SME: 11950]

1 jpp 1.1 diff -Nur --no-dereference e-smith-base-5.8.1.old/createlinks e-smith-base-5.8.1/createlinks
2     --- e-smith-base-5.8.1.old/createlinks 2022-04-16 23:39:45.153000000 -0400
3     +++ e-smith-base-5.8.1/createlinks 2022-04-16 23:46:57.368000000 -0400
4     @@ -307,8 +307,9 @@
5     templates2events("/usr/lib/systemd/system/dhcpd.service.d/50koozali.conf", $event);
6     event_link("systemd-journald", $event, "02");
7     event_link("fix-startup", $event, "05");
8     -event_link("rotate_logfiles", $event, "05");
9     event_link("init-accounts", $event, "05");
10     +event_link("logrotate-migrate", $event, "06");
11     +event_link("rotate_logfiles", $event, "07");
12     event_link("set-hostname", $event, "10");
13     event_link("rmmod-bonding", $event, "10");
14     event_link("conf-startup", $event, "10");
15     @@ -446,8 +447,8 @@
16     templates2events("/usr/lib/systemd/system/dhcpd.service.d/50koozali.conf", $event);
17     event_link("systemd-journald", $event, "02");
18     event_link("fix-startup", $event, "05");
19     -event_link("rotate_logfiles", $event, "05");
20     event_link("init-accounts", $event, "05");
21     +event_link("rotate_logfiles", $event, "07");
22     event_link("init-passwords", $event, "10");
23     event_link("conf-startup", $event, "10");
24     event_link("user-rsshd", $event, "16");
25     @@ -466,8 +467,9 @@
26     templates2events("/usr/lib/systemd/system/dhcpd.service.d/50koozali.conf", $event);
27     event_link("systemd-journald", $event, "02");
28     event_link("fix-startup", $event, "05");
29     -event_link("rotate_logfiles", $event, "05");
30     event_link("init-accounts", $event, "05");
31     +event_link("logrotate-migrate", $event, "06");
32     +event_link("rotate_logfiles", $event, "07");
33     event_link("conf-startup", $event, "10");
34     event_link("user-lock-passwd", $event, "15");
35     event_link("group-modify-unix", $event, "15");
36     @@ -583,7 +585,8 @@
37    
38     $event = "logrotate";
39    
40     -event_link("rotate_logfiles", $event, "05");
41     +event_link("logrotate-migrate", $event, "06");
42     +event_link("rotate_logfiles", $event, "07");
43     event_link("purge-old-logs", $event, "75");
44    
45     safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/rsyslog");
46     diff -Nur --no-dereference e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/logrotate-migrate e-smith-base-5.8.1/root/etc/e-smith/events/actions/logrotate-migrate
47     --- e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/logrotate-migrate 1969-12-31 19:00:00.000000000 -0500
48 jpp 1.3 +++ e-smith-base-5.8.1/root/etc/e-smith/events/actions/logrotate-migrate 2022-04-16 23:59:07.124000000 -0400
49     @@ -0,0 +1,51 @@
50 jpp 1.1 +#!/bin/bash
51     +# this script is to migrate old symlink log to regular file in order
52     +# to be handled by logrotate
53     +
54     +#known files that could be symlinks
55     +FILES="/var/log/cron
56     +/var/log/maillog
57     +/var/log/messages
58     +/var/log/secure
59     +/var/log/spooler
60     +/var/log/boot.log
61     +/var/log/httpd/admin_access_log
62     +/var/log/httpd/admin_error_log
63     +/var/log/httpd/access_log
64     +/var/log/httpd/error_log
65     +/var/log/httpd/fpbx_error_log
66     +/var/log/httpd/fpbx_access_log
67     +/var/log/httpd/bkpc_access_log
68     +/var/log/httpd/bkpc_error_log
69     +/var/log/httpd/issoqlog_access_log
70 jpp 1.3 +/var/log/httpd/isoqlog_access_log
71 jpp 1.1 +/var/log/httpd/isoqlog_error_log
72     +/var/log/httpd/pki_access_log
73     +/var/log/httpd/pki_error_log
74     +/var/log/pluto/pluto.log"
75     +
76     +
77     +#counter
78     +found=0
79     +
80     +# could do also $(find /var/log/ -type l)
81     +for f in $FILES
82     +do
83     + if [ -L "$f" ]; then
84     + echo "Processing $f"
85     + mylink=$(readlink "$f")
86     + unlink $f
87     + touch $f
88 jpp 1.2 + if [ -f "$mylink" ]; then
89     + cp --attributes-only "$mylink" "$f"
90     + fi
91 jpp 1.1 + found ++
92     + fi
93     +done
94     +
95     +# restart the needed services
96     +if [ $found > 0 ] ; then
97     + /usr/bin/systemctl restart httpd-*.service > /dev/null 2>/dev/null
98     + /usr/bin/systemctl restart rsyslog.service > /dev/null 2>/dev/null
99     +fi
100     +

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