-
Notifications
You must be signed in to change notification settings - Fork 3
/
dnf-smb-mon
29 lines (24 loc) · 1.21 KB
/
dnf-smb-mon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
#dnf_smb_mon
#Monitoring script that will compare the @System Repository with the Upstream Repository for Samba DC
#If a match between the files are resolved, there will be no update
#If a match is NOT resolved between files, a messages will be sent to MOTD and upon netc login the (root) User should run "samba-dnf-pkg-update"
dnf makecache
dnflocal=$(dnf provides samba | grep Provide | sed 's/.dc//' |sed '1d')
dnfremote=$(dnf provides samba | grep Provide | sed 's/.dc//' | sed '$d')
if [ "$dnflocal" == "$dnfremote" ]; then
logger -s "dnf-smb-mon reports no changes needed-Repositories are in sync" 2>>/var/log/dnf-smb-mon.log
else
cat <<EOF >/etc/motd
*********************************************
ATTENTION!
*********************************************
dnf_smb_mon sees a difference between the @System dnf repository
for Samba and the dnf repository upstream. This probably means that
the upstream Samba packages are a new version and the --dc packages
are now out of date.
You should probably run the command samba-dnf-pkg-update.
EOF
logger -s "dnf-smb-mon reports changes -Repositories are NOT in sync. Review and run samba-dnf-pkg-update" 2>>/var/log/dnf-smb-mon.log
fi
exit