0

I have following script:

Tgtfile=/data/rse_outbound_feeds/tgtfiles
TEMPFILE=/data/rse_outbound_feeds/scripts/ftp_ap_automation.txt
TEMPFILE1=/data/rse_outbound_feeds/scripts/ftp_ap_automation1.txt
v_filename=$1
v_filename2=$2

echo "open int.inside.rhusa.com 21" > ${TEMPFILE}
echo "user eclipse Pa55w0rd" >> ${TEMPFILE}
echo "cd /opt/apps/integ/eclipse/outbound/eclipse_boxi_ap/" >> ${TEMPFILE}
echo "lcd /data/rse_outbound_feeds/tgtfiles" >> ${TEMPFILE}
echo "put $v_filename" >> ${TEMPFILE}
echo "put $v_filename2" >> ${TEMPFILE}
echo "close int.inside.rhusa.com" >> ${TEMPFILE}
echo "bye" >> ${TEMPFILE}
ftp -n -v < ${TEMPFILE} > $Tgtfile/ftp_ap_automation_soa_output.txt  

egrep "Not connected|Login failed|not found|Not found|No such|refused|Failed|error|Error|timed out|Timed out" $Tgtfile/ftp_ap_automation_soa_output.txt > $Tgtfile/ftp_ap_automation_soa_mail_body.txt

if [ $? -eq 0 ]
    then
                mailx -s "CRITICAL: FTP to SOA failed for AP Automation         (Corcentric extracts)" "[email protected]" <   $Tgtfile/ftp_ap_automation_soa_mail_body.txt
fi
rm -rf ${TEMPFILE}
rm -rf $Tgtfile/ftp_ap_automation_soa_mail_body.txt
rm -rf $Tgtfile/ftp_ap_automation_soa_output.txt
rm -rf $Tgtfile/ftp_ap_automation_output.txt

When i execute this script it says that '$Tgtfile/ftp_ap_automation_soa_output.txt ' cannot create this file (No such file found). The script has access of '755' and the above file has to be created at run time. I am not able to find why script is not able to create this file. This file will have log information for ftp. From which we would detect if there are any errors while doing ftp and then send out mail to client.

Any help would be appreciated. Thanks in advance.

1 Answer 1

1

Does the Tgtfile is a directory and exists? cause

: > /path/to/not/exists/file

would fail with message: -bash: /path/to/not/exists/file: No such file or directory

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.