Here are two simple Korn shell scripts you can cron to monitor things on your linux server
Modified from scripts I use on my own servers at home.
:::::::::::::: filemonitor.ksh :::::::::::::: #!/usr/bin/ksh #This script monitors the watched_dir for files matching the watched_filter and #sends email when new files how show up
script_dir=/path/to/script datestamp=`date '+%Y%m%d%H%M%S'`
watched_dir=/path/to/watched_dir watched_filter=file_ email_subj="ALERT: Files Waiting in Watched Directory" email_to="email1@domain.com,email2@domain.com"
cd $script_dir
ls -1 -d $watched_dir/*.* | grep $watched_filter > current_files
if [ -f last_files ] then diff current_files last_files | grep "<" |awk '{printf("%s\n",$2)}' > notify_files else cp current_files notify_files fi line_count=`wc -l notify_files|awk '{print $1}'` if [ $line_count -gt 0 ] then files=`cat notify_files` more $files > files.txt
mail -s "$email_subj" "$email_to" < files.txt fi mv current_files last_files mv files.txt filearc/files_$datestamp.txt rm notify_files cd -
:::::::::::::: checkwebsite.ksh :::::::::::::: #!/usr/bin/ksh
#This script monitors a webpage and if it changes more than (100 - alert_percent) #sends email to the listed people script_dir=/path/to/script script_dir=/usr/local/transfer/data/reports/ops/notifyscript datestamp=`date '+%Y%m%d%H%M%S'`
url_to_check="domain.com/webpage"
alert_percent=80
email_subj="ALERT: Monitored WebPage <$url_to_check>" email_to="email1@domain.com,email2@domain.com"
cd $script_dir
wget -q -O current_website $url_to_check
if [ -f last_website ] then
total_lines_current=`wc -l current_website | awk '{print $1}'`
total_lines_last=`wc -l last_website | awk '{print $1}'`
total_nonmatch_lines=`diff current_website last_website|egrep '^[<>]+' | wc -l`
total_nonmatch_lnc=`expr $total_nonmatch_lines \* 100` total_nonmatch_pctg=`expr $total_lines_current + $total_lines_last` total_nonmatch_pctg=`expr $total_nonmatch_lnc / $total_nonmatch_pctg` total_match_pctg=`expr 100 - $total_nonmatch_pctg`
if [ $total_match_pctg -lt $alert_percent ] then
echo "The monitored webpage <$url_to_check> is more than $total_nonmatch_pctg% different than the stored copy from last run, the threshold is $alert_percent%." | mail -s "$email_subj" "$email_to"
echo $total_nonmatch_pctg fi fi
mv current_website last_website cd -











