Hello all,
As stated in my last post I would update you on my current work and the additions to the back up script already in place.
I worked on a way to monitor the directory in question. I do not have it setup as a cron job yet.
I just need a bit of advice, Which would be more affective the script listed below or to use: (RED TEXT)
Use the find command. Something like: find . -mtime +1. This will check the current directory for anything that has been modified over 1 day. You can read how cron works, it's very simple. Let us know if you need help with the syntax
If I use the mtime command how do I incorporate it into a script that will email the results to me?
My plan for this script is to check the directory in question every 24hours send a report via email and if any changes were made to any files with in the directory in question the files within that directory should be backed up.
Am I going about this the wrong way?
Am I trying to reinvent the wheel?
I use Google and this Forum as my teaching guide with a copy of the advance bash shell scripting guide that I downloaded from the net
################### Code ######################
#!/bin/bash
# File Monitor
#
# 5/6/07 Initial Version
function list () {
ls -lsa > filescan.txt
sleep 20
}
while true; do
list
echo "Data of the last scan was sent to admin."
echo "Next file scan will start in 2 seconds!"
echo "Starting Scan!"
sleep 10
clear
cat filescan.txt
echo "directory Scan Report." | mail -s "File Monitor report"
me@mail.com < filescan.txt
done
################### End Code ######################