UPD: minor updates

This commit is contained in:
xpk 2020-04-23 23:04:32 +08:00
parent 6523b75af4
commit a49025b660
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Get yum transaction # 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 cp $(tail -1 /root/yum-check.txt | awk '{print $NF}') /root/yum-transaction.yumtx
# Use yum output to construct a notification # 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 -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 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