Hi,
i have the following script:
SET_ENV ()
{
DESTDIR=/home/tarek/my_documents
DATE=`date +'%m%d`_????
LOCALDIR=/home/oracle/test/$DATE/files
LOGFILE=$LOCALDIR/script_ftp.log
FILE=pippo*
}
FTP_FILES ()
{
echo "####################"
echo "STARTING FTP SESSION"
echo "####################"
ftp -n ip <<eof
user $1 $2
ascii
prompt
lcd $LOCALDIR
cd $DESTDIR
put $FILE
bye
eof
EXITSTAT=$?
echo "Exit status from FTP is $EXITSTAT"
if [ $EXISTAT -eq 0 ]
then
echo "FTP Was OK"
else
echo "ERROR: unknown-error after <FTP_FILES> for file <$FILE> "
exit -2
fi
}
MAIN ()
{
SET_ENV
exec > $LOGFILE 2>&1
FTP_FILES user password
}
MAIN
I have an error while trying to create the $LOGFILE:
A file or directory in the path name does not exist.
./script_files[3]: /home/oracle/test/0919_????/files/script_ftp.log: 0403-005 Cannot create the specified file.
Any idea?
And then how can i test the existatus of the ftp?
If the ftp is ok or it has an error $? is always 0.
Tarek
i have the following script:
SET_ENV ()
{
DESTDIR=/home/tarek/my_documents
DATE=`date +'%m%d`_????
LOCALDIR=/home/oracle/test/$DATE/files
LOGFILE=$LOCALDIR/script_ftp.log
FILE=pippo*
}
FTP_FILES ()
{
echo "####################"
echo "STARTING FTP SESSION"
echo "####################"
ftp -n ip <<eof
user $1 $2
ascii
prompt
lcd $LOCALDIR
cd $DESTDIR
put $FILE
bye
eof
EXITSTAT=$?
echo "Exit status from FTP is $EXITSTAT"
if [ $EXISTAT -eq 0 ]
then
echo "FTP Was OK"
else
echo "ERROR: unknown-error after <FTP_FILES> for file <$FILE> "
exit -2
fi
}
MAIN ()
{
SET_ENV
exec > $LOGFILE 2>&1
FTP_FILES user password
}
MAIN
I have an error while trying to create the $LOGFILE:
A file or directory in the path name does not exist.
./script_files[3]: /home/oracle/test/0919_????/files/script_ftp.log: 0403-005 Cannot create the specified file.
Any idea?
And then how can i test the existatus of the ftp?
If the ftp is ok or it has an error $? is always 0.
Tarek