Home » Infrastructure » Linux » shell script (linux)
shell script [message #424149] Wed, 30 September 2009 06:03 Go to next message
siddabathuni
Messages: 3
Registered: December 2008
Location: hyderabad
Junior Member
Hi,

I have shell script which moves the files from linux machine to FTP Windows machine . But some time because of network problem the file are not uploading .Her i need to get the mail weather the files are uploaded or not.

Here i am trying to get the mail weather the files were uploaded successfully or not .For this i am trying in two different ways

1.) Before uploading i would like to ping the ftp server if it is pinging then the files will be uploaded and the get the mail successfully moved.Other wise if it is not pinging i will get the mail not move .

2.) After moving the file to ftp here i will again get those ftp uploaded folder back to the server and if i find the folder in my server then i want to get the success mail other wise not success mail.

Pleas suggest me which is the best one and pleas help me in my code how to use ping command in the script.Here is my script.



#!/bin/bash
HOST='192.168.7.156'
USER='rishna'
PASSWD='tration'
#FILE='*'
#DT=$(date +%a_%h_%d_%Y)
if [ ]
then
DT=$(date +%Y-%m-%d)
ftp -n $HOST > .ftpout.txt 2>.ftperr.txt <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
#lcd /home/oracle/test
lcd /u04/dbdump/
cd sample
mkdir $DT
cd $DT
prompt
mput *
quit
END_SCRIPT
echo "FTP worked " | mail -s "errors are " sample@chi.com
else
echo "FTP dosent worked" | mail -s "errors are " sample@chi.com
fi


Re: shell script [message #424173 is a reply to message #424149] Wed, 30 September 2009 07:20 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
How about just checksum and filesize?
Depending on the type of files you may want use bin option.
And this question has nothing to do with Oracle. Please
post in appropriate forum.

[Updated on: Wed, 30 September 2009 11:19]

Report message to a moderator

Re: shell script [message #424178 is a reply to message #424173] Wed, 30 September 2009 07:42 Go to previous message
siddabathuni
Messages: 3
Registered: December 2008
Location: hyderabad
Junior Member
Hi,

The file are text files.And the size will be less than 1mb
Previous Topic: memory usage
Next Topic: ORA-01034: ORACLE not available
Goto Forum:
  


Current Time: Thu Mar 28 09:20:17 CDT 2024