From a49025b660f9676d2397c27ac9f8d7d06b01ce61 Mon Sep 17 00:00:00 2001 From: x p k Date: Thu, 23 Apr 2020 23:04:32 +0800 Subject: [PATCH] UPD: minor updates --- sh/{yum-notifycation.sh => yum-notify.sh} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename sh/{yum-notifycation.sh => yum-notify.sh} (74%) diff --git a/sh/yum-notifycation.sh b/sh/yum-notify.sh similarity index 74% rename from sh/yum-notifycation.sh rename to sh/yum-notify.sh index 631715a..e6e98f6 100644 --- a/sh/yum-notifycation.sh +++ b/sh/yum-notify.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # Get yum transaction -yum --assumeno update | tee /root/yum-check.txt +yum --assumeno update > /root/yum-check.txt +grep -q yumtx /root/yum-check.txt || exit 0 cp $(tail -1 /root/yum-check.txt | awk '{print $NF}') /root/yum-transaction.yumtx # Use yum output to construct a notification @@ -10,6 +11,5 @@ grep -E '(base|updates).*[kM]' /root/yum-check.txt | awk '{print $1"-"$3}' >> /r echo -e "\n\nTo install these updates, run the following command:" >> /root/yum-notice.txt echo "yum -y load-transaction /root/yum-transaction.yumtx" >> /root/yum-notice.txt -# /root/yum-notice.txt can now be sent to user - +cat /root/yum-notice.txt | mailx -s "Update report from $(hostname)" -- xpk@headdesk.me