Formatting a bash cat pipe to mail command -
Formatting a bash cat pipe to mail command -
when wrote script works fine. diffs 2 file , if diff fails indicates no alter between todays file , previous days file. menas the download stale. when email it not formatted. treid putting in newline email legible. mail service function not work. file garbled read.
#!/bin/bash dayofweek=$(/bin/date +%w) today=$(/bin/date +%y.%m.%d_) yesterday=$(/bin/date -d '1 day ago' +%y.%m.%d_) destination="/sbclocal/stmevt3/dailymetrics/eq_performance/" file1=opts_trip_trip_csv_oct2014.csv file2=opts_tripnon-penny1-20_tripnon-penny1-20_oct2014.csv file3=opts_tripnon-penny21-50_tripnon-penny21-50_oct2014.csv file4=opts_tripnon-penny51-100_tripnon-penny51-100_oct2014.csv file5=opts_trippenny1-20_trippenny1-20_oct2014.csv file6=opts_trippenny21-50_trippenny21-50_oct2014.csv file7=opts_trippenny51-100_trippenny51-100_oct2014.csv in $file1 $file2 $file3 $file4 $file5 $file6 $file7 if diff $destination$today$i $destination$yesterday$i > /dev/null ; printf "$today$i may stale - please notify production\n" >> /tmp/eq_diffs.$today sleep 2 else echo " " > /dev/null fi done #think might have if file exists cat /tmp/eq_diffs.$today | mail service -s "eq performance diffs" casper@casper.com
bash formatting sendmail
Comments
Post a Comment