Bash script help?
- From: elroyerni <davechunny@xxxxxxxxx>
- Date: Thu, 21 Feb 2008 12:43:16 -0800 (PST)
I wrote this script to copy a file from my desktop to my nfs storage.
The problem is when i intentionally put the "sleep 3" line in my
script I expect it to send a email saying writing to the nfs took
longer than 2 seconds but it doesn't. It seems that i can't pass the
variable over? Do I need to re-write this in perl? Can anyone point me
to some literature or have some suggestions? Thanks!
COMMAND=$(cp /u/dchun/file.txt /10.0.0.4/stuff/file.txt)
if [ "$COMMAND" != '' ]; then
message="NAS write failure TIME $(date +"%Y%m%d%H%M%S")"
echo "$message"| mail -s "ALERT: Can't write to NAS"
total_time=`expr $stop_time - $start_time`
elif [ "$total_time" -gt 2 ]; then
message="NAS write took too long $(date +"%Y%m%d%H%M%S")"
echo "$message"| mail -s "ALERT: Writing to NAS took longer
than 2 seconds" sam@xxxxxxxxx
else message="NAS OK"
echo $(date +"%Y%m%d%H%M%S"):$message >> /u/dchun/cron/nfs_check.log
- Prev by Date: Re: Get rid off last char on last line
- Next by Date: Re: Bash script help?
- Previous by thread: RSC description field
- Next by thread: Re: Bash script help?