/[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.2 - (hide annotations) (download)
Sun Apr 17 03:56:39 2022 UTC (2 years, 7 months ago) by jpp
Branch: MAIN
Changes since 1.1: +5 -3 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.2 +++ e-smith-base-5.8.1/root/etc/e-smith/events/actions/logrotate-migrate 2022-04-16 23:54:07.894000000 -0400
49     @@ -0,0 +1,50 @@
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     +/var/log/httpd/isoqlog_error_log
71     +/var/log/httpd/pki_access_log
72     +/var/log/httpd/pki_error_log
73     +/var/log/pluto/pluto.log"
74     +
75     +
76     +#counter
77     +found=0
78     +
79     +# could do also $(find /var/log/ -type l)
80     +for f in $FILES
81     +do
82     + if [ -L "$f" ]; then
83     + echo "Processing $f"
84     + mylink=$(readlink "$f")
85     + unlink $f
86     + touch $f
87 jpp 1.2 + if [ -f "$mylink" ]; then
88     + cp --attributes-only "$mylink" "$f"
89     + fi
90 jpp 1.1 + found ++
91     + fi
92     +done
93     +
94     +# restart the needed services
95     +if [ $found > 0 ] ; then
96     + /usr/bin/systemctl restart httpd-*.service > /dev/null 2>/dev/null
97     + /usr/bin/systemctl restart rsyslog.service > /dev/null 2>/dev/null
98     +fi
99     +

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