This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Shell execution


I'm new to cygwin (latest) and NT (4.0 sp 6) but not to UNIX.   I am experiencing a conflict between bash and cron execution and hope someone can point out what I've missed. 

When I run a shell from the cygwin prompt/command line, it works fine.

When I schedule the same shell in cron, I get errors saying the files I'm trying to grep on don't exist.   I am using an "*" in the filename because there are several, as in file1.log, file2.log, file3.log, etc.

The script follows.

#!/bin/bash

SID=fprd
xwork=/tmp/check.wrk1
xdisk=/cygdrive/m/Backups/COLDBACKUPS/FPRD/Logs

cnt=$(grep -i '0 file' $xdisk/$SID_copyjob*.log | wc -l )
cnt=$(echo $cnt | tr -d ' ')

if [ $cnt -gt 0 ] ; then
   echo "To: xxxx@airtouchpaging.net"                   >$xwork
#   echo "To: xxx@xxx.org"                   >$xwork
  echo "Cc: xxx@xxx.org"                                       >>$xwork
   echo "Subj: Cold Backup Error! There were $cnt files not copied. Please manually copy.  " >>$xwork
   
   ssmtp -F "DBA Alert" -t <$xwork
fi

exit 0

# end of script

Any help will be appreciated.  I'm sure there is just a setting I've missed somewhere.

Thanks!  

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]