1 |
diff -Nur smeserver-yum-2.4.0.old/root/etc/e-smith/templates/etc/crontab/check4contribsupdates smeserver-yum-2.4.0/root/etc/e-smith/templates/etc/crontab/check4contribsupdates |
2 |
--- smeserver-yum-2.4.0.old/root/etc/e-smith/templates/etc/crontab/check4contribsupdates 1970-01-01 01:00:00.000000000 +0100 |
3 |
+++ smeserver-yum-2.4.0/root/etc/e-smith/templates/etc/crontab/check4contribsupdates 2014-11-19 17:59:47.540381038 +0100 |
4 |
@@ -0,0 +1,25 @@ |
5 |
+{ |
6 |
+ return "\n# yum check for updates is disabled\n" unless $yum{status} eq 'enabled'; |
7 |
+ |
8 |
+ my $freq = $yum{check4contribsupdates} || 'daily'; |
9 |
+ |
10 |
+ my $min; |
11 |
+ my $dom; |
12 |
+ my $dow; |
13 |
+ |
14 |
+ if ($freq eq 'weekly') { |
15 |
+ $min = 22; |
16 |
+ $dom = '*'; |
17 |
+ $dow = 0; |
18 |
+ } elsif ($freq eq 'monthly') { |
19 |
+ $min = 42; |
20 |
+ $dom = 1; |
21 |
+ $dow = '*'; |
22 |
+ } else { |
23 |
+ $min = 2; |
24 |
+ $dom = '*'; |
25 |
+ $dow = '*'; |
26 |
+ } |
27 |
+ return "$min 4 $dom * $dow root " |
28 |
+ . q{sleep $[ $RANDOM \\% 3600 ]; /sbin/e-smith/check4contribsupdates -m }; |
29 |
+} |
30 |
diff -Nur smeserver-yum-2.4.0.old/root/sbin/e-smith/check4contribsupdates smeserver-yum-2.4.0/root/sbin/e-smith/check4contribsupdates |
31 |
--- smeserver-yum-2.4.0.old/root/sbin/e-smith/check4contribsupdates 1970-01-01 01:00:00.000000000 +0100 |
32 |
+++ smeserver-yum-2.4.0/root/sbin/e-smith/check4contribsupdates 2014-11-19 17:58:02.709057486 +0100 |
33 |
@@ -0,0 +1,27 @@ |
34 |
+#! /bin/bash |
35 |
+ |
36 |
+mkdir -p /tmp/check4contribsupdates.$$ |
37 |
+TMPFILE=`mktemp /tmp/check4contribsupdates.$$/XXXXXXXXXX` || exit 1 |
38 |
+TMP1=`mktemp /tmp/check4contribsupdates.$$/XXXXXXXXXX` || exit 1 |
39 |
+ |
40 |
+MAILADDR=admin-yum |
41 |
+ |
42 |
+yum -e 0 -d 0 check-update --disablerepo=* --enablerepo=smecontribs > $TMP1 |
43 |
+if [ $? = 100 ]; then |
44 |
+ echo -e "===\n=== yum reports available updates for Contribs :\n===" >> $TMPFILE |
45 |
+ cat $TMP1 >> $TMPFILE |
46 |
+ echo -e "\n To apply all these updates, you can log on your server and run the following command :\n |
47 |
+ yum update --enablerepo=smecontribs\n" >> $TMPFILE |
48 |
+fi |
49 |
+ |
50 |
+if [ -s $TMPFILE ]; then |
51 |
+ if [ "$1" = "-m" ]; then |
52 |
+ mail -s "SME Server Contribs Updates available for `hostname`" $MAILADDR < $TMPFILE |
53 |
+ else |
54 |
+ echo "SME Server Contribs Updates available for `hostname`" |
55 |
+ cat $TMPFILE |
56 |
+ fi |
57 |
+fi |
58 |
+ |
59 |
+rm -f $TMPFILE $TMP1 |
60 |
+rm -fr /tmp/check4contribsupdates.* |