Getting exit status code from 'ftp' command in linux shell

后端 未结 6 1179
半阙折子戏
半阙折子戏 2020-12-28 23:08

I need to retrive the exit status code from a command line program. No worries, I used $?. But for ftp, even if it doesn\'t connect, it opens the ftp shell, so I\'m not able

6条回答
  •  暖寄归人
    2020-12-28 23:12

    Another way around this is to check if you have the file on your server post transfer!

    Something like...

    if ![ -s "$INPUT_DIR/HOP_PSA_Transactions_$BATCH_ID.csv" ]
    then
        ## No Transactions file
        FAIL_TIME=`date +"%d-%m-%Y %H:%M"`
    	echo "ERROR: File HOP_PSA_Transactions_$BATCH_ID.csv not found @ $FAIL_TIME" >>$LOGFILE_DIR$LOGFILE_NAME
    	exit $ERR_NO_TRANS_FILE    
    fi

    If it's not there then it didn't transfer successfully!

提交回复
热议问题