Created
June 26, 2019 11:06
-
-
Save pyllyukko/a0ef50d1bbb28d148c4a41f651a8d929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# pkg_audit.sh for FreeBSD | |
# Run from cron so it will mail the diff | |
umask 077 | |
oldlog="/root/pkg_audit.txt" | |
newlog="$( /usr/bin/mktemp )" | |
/usr/sbin/pkg audit -F 1>"${newlog}" | |
/usr/bin/sed -i -e 1d "${newlog}" | |
if [ ! -f "${oldlog}" ] | |
then | |
/bin/mv "${newlog}" "${oldlog}" | |
exit 0 | |
fi | |
if /usr/bin/cmp "${oldlog}" "${newlog}" | |
then | |
/bin/rm "${newlog}" | |
else | |
/usr/bin/diff "${oldlog}" "${newlog}" | |
/bin/mv "${newlog}" "${oldlog}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment