Update 'filewatcher.sh'
This commit is contained in:
4
filewatcher.sh
Executable file → Normal file
4
filewatcher.sh
Executable file → Normal file
@@ -27,9 +27,9 @@ echo "Monitoring file $1 for changes - sending alerts to $2"
|
|||||||
while inotifywait -e modify -e attrib -e move -e delete $1 -o /opt/filewatcher/audit.log; do
|
while inotifywait -e modify -e attrib -e move -e delete $1 -o /opt/filewatcher/audit.log; do
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# changes="$(tail -n5 $1)"
|
changes="$(tail -1 $1)"
|
||||||
|
|
||||||
changes="$(cat /opt/filewatcher/audit.log)"
|
#changes="$(cat /opt/filewatcher/audit.log)"
|
||||||
echo "The following change occurred in the file $1 : $changes" | mail -s "Change in $1" $2
|
echo "The following change occurred in the file $1 : $changes" | mail -s "Change in $1" $2
|
||||||
rm /opt/filewatcher/audit.log
|
rm /opt/filewatcher/audit.log
|
||||||
touch /opt/filewatcher/audit.log
|
touch /opt/filewatcher/audit.log
|
||||||
|
|||||||
Reference in New Issue
Block a user