From 60c400231b16036deb2229e19436800ee2a54334 Mon Sep 17 00:00:00 2001 From: Mike Holloway Date: Fri, 4 Mar 2022 00:30:06 -0500 Subject: [PATCH] Added log file support for non-systemd systems --- hash-files | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hash-files b/hash-files index 2e241cc..808f660 100755 --- a/hash-files +++ b/hash-files @@ -4,6 +4,7 @@ source .env 2>&1 > /dev/null set +a DateTimeStamp=$(date +\%D_\%T) +log_file=/var/log/hash-files.log ## Functions ############ @@ -11,7 +12,9 @@ DateTimeStamp=$(date +\%D_\%T) write_log () { #echo " ++ Write to log. # +++++++++++++++" - printf '%s hash-files: %s\n' "$DateTimeStamp" "$1" +## Use on systems managed with systemd +# printf 'hash-files: %s\n' "$1" | systemd-cat + printf '%s hash-files: %s\n' "$DateTimeStamp" "$1" >> $log_file } create_list_of_files () {