Don't know if this is the right forum for this question, but here goes........
I am just beginning to have to write shell scripts to run SQR processes in UNIX.
I have a script that is having problems copying a file. My code snippet is:
#copy output file out_file1
if [[ -s $out_file1 ]]
then
cp $out_file1 /cde/datasnd/CLIENT/$pg_name2.csv
chmod 666 /cde/datasnd/CLIENT/$pg_name2.csv
file_date=`date +'%Y%m%d.%H.%M.%S'`
arc_file=$ARC_LOC/$pg_name.$FILE_DB.$file_date.dta
cp $out_file1 $arc_file
# Payroll Automation project - copy outbound files to Payroll directories
$SH_LOC/pr_filecopy.sh O D $arc_file NORUNID
gzip $arc_file
chmod 666 $arc_file.gz
# comment out - mv $out_file1 $DATA_LOC/$pg_name2.csv
else
MSG="Process Notice - Output file $out_file1 does not exist"
SUBJ="Process Notice - $FILE_DB - Output file not found"
echo $MSG
# send_message $RECIPIENTS "$MSG" "$SUBJ"
fi
The error messages I get are:
+ [[ -s /opt/PROD/CLIENT/DATA/group.recog_bw.csv ]]
+ cp /opt/PROD/CLIENT/DATA/group.recog_bw.csv /cde/datasnd/CLIENT/group.recog_bw.csv
cp: cannot create /cde/datasnd/CLIENT/group.recog_bw.csv: No such file or directory
+ chmod 666 /cde/datasnd/CLIENT/group.recog_bw.csv
chmod: WARNING: can't access /cde/datasnd/CLIENT/group.recog_bw.csv
I have checked the folder /cde/datasnd/CLIENT/ and it exists.
I have looked at the /opt/PROD/CLIENT/DATA/group.recog_bw.csv and it is there and has 777 rights.
I can manually upload the file into the /cde/datasnd/CLIENT/ with no problems.
There has to be a script error, but I don't see it.
Any Unix shell gurus out there?
Thanks,
jej
I am just beginning to have to write shell scripts to run SQR processes in UNIX.
I have a script that is having problems copying a file. My code snippet is:
#copy output file out_file1
if [[ -s $out_file1 ]]
then
cp $out_file1 /cde/datasnd/CLIENT/$pg_name2.csv
chmod 666 /cde/datasnd/CLIENT/$pg_name2.csv
file_date=`date +'%Y%m%d.%H.%M.%S'`
arc_file=$ARC_LOC/$pg_name.$FILE_DB.$file_date.dta
cp $out_file1 $arc_file
# Payroll Automation project - copy outbound files to Payroll directories
$SH_LOC/pr_filecopy.sh O D $arc_file NORUNID
gzip $arc_file
chmod 666 $arc_file.gz
# comment out - mv $out_file1 $DATA_LOC/$pg_name2.csv
else
MSG="Process Notice - Output file $out_file1 does not exist"
SUBJ="Process Notice - $FILE_DB - Output file not found"
echo $MSG
# send_message $RECIPIENTS "$MSG" "$SUBJ"
fi
The error messages I get are:
+ [[ -s /opt/PROD/CLIENT/DATA/group.recog_bw.csv ]]
+ cp /opt/PROD/CLIENT/DATA/group.recog_bw.csv /cde/datasnd/CLIENT/group.recog_bw.csv
cp: cannot create /cde/datasnd/CLIENT/group.recog_bw.csv: No such file or directory
+ chmod 666 /cde/datasnd/CLIENT/group.recog_bw.csv
chmod: WARNING: can't access /cde/datasnd/CLIENT/group.recog_bw.csv
I have checked the folder /cde/datasnd/CLIENT/ and it exists.
I have looked at the /opt/PROD/CLIENT/DATA/group.recog_bw.csv and it is there and has 777 rights.
I can manually upload the file into the /cde/datasnd/CLIENT/ with no problems.
There has to be a script error, but I don't see it.
Any Unix shell gurus out there?
Thanks,
jej