aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cron-sh/functions.sh')
-rw-r--r--cron-sh/functions.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/cron-sh/functions.sh b/cron-sh/functions.sh
index e987d91..594d703 100644
--- a/cron-sh/functions.sh
+++ b/cron-sh/functions.sh
@@ -37,6 +37,24 @@ FILTER="\(`echo $EXCLUDEDIR | sed -e 's/ /\\\|/g'`\)"
### Functions ###
+Diffcheck() {
+ TODAY="$1"
+ YESTERDAY="$2"
+ DIFF="$3"
+ MESSAGE="$4"
+ if [[ -f ${YESTERDAY} ]]; then
+ if ! diff -u ${YESTERDAY} ${TODAY} > ${DIFF}; then
+ printf "\nSecurity Warning: change in $MESSAGE found :\n" >> ${DIFF}
+ grep '^+' ${DIFF} | grep -vw "^+++ " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do
+ printf "\t\t- Newly added $MESSAGE : ${file}\n"
+ done >> ${DIFF}
+ grep '^-' ${DIFF} | grep -vw "^--- " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do
+ printf "\t\t- No longer present $MESSAGE : ${file}\n"
+ done >> ${DIFF}
+ fi
+ fi
+}
+
Syslog() {
if [[ ${SYSLOG_WARN} == yes ]]; then
cat ${1} | while read line; do