[oracle@localhost visitor_log]$ cat cmd12.sh
export COMMAND=/data1/oracle/dilip/log/cmd11.sh
YESTERDAY=$(date --date "1 days ago" +%d%m%y)
FILE=visitlog_$YESTERDAY.txt
REMOTE_ADD=/usr/local/apache/htdocs/mycmp/Log/
export LOCALDIR=/data1/oracle/dilip/log
cd /data1/oracle/dilip/log
echo "#!/usr/bin/expect --" > $COMMAND
echo >> $COMMAND
echo >> $COMMAND
echo >> $COMMAND
echo >> $COMMAND
echo "set timeout 60" >> $COMMAND
echo "log_file $LOCALDIR/ftp.log" >> $COMMAND
echo "spawn ftp XXX.XXX.XXX.XXX" >> $COMMAND
echo "expect \"Name:\"" >> $COMMAND
echo "send \"www1\\r\"" >> $COMMAND
echo "expect \"Password:\"" >> $COMMAND
#echo "sleep 40" >> $COMMAND
echo "send \"passphase\\r\"" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"lcd $LOCALDIR\\r\"" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"cd $REMOTE_ADD\\r\"" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"get $DATAFILE\\r\"" >> $COMMAND
#echo "sleep 500" >> $COMMAND
echo "set timeout -1" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"bye\\r\"" >> $COMMAND
#echo "sleep 120" >> $COMMAND
echo exit >> $COMMAND
chmod 755 $COMMAND
$COMMAND
ENDTIME=`date '+%s'`
echo "Total Time taken `expr $ENDTIME - $STARTTIME` Seconds"
#!/usr/bin/expect --
cat $FILE> VISIT_LOG_BIG
[oracle@localhost visitor_log]$
47 01 * * * sh /data1/oracle/dilip/visit_log/cmd12.sh
export COMMAND=/data1/oracle/dilip/log/cmd11.sh
YESTERDAY=$(date --date "1 days ago" +%d%m%y)
FILE=visitlog_$YESTERDAY.txt
REMOTE_ADD=/usr/local/apache/htdocs/mycmp/Log/
export LOCALDIR=/data1/oracle/dilip/log
cd /data1/oracle/dilip/log
echo "#!/usr/bin/expect --" > $COMMAND
echo >> $COMMAND
echo >> $COMMAND
echo >> $COMMAND
echo >> $COMMAND
echo "set timeout 60" >> $COMMAND
echo "log_file $LOCALDIR/ftp.log" >> $COMMAND
echo "spawn ftp XXX.XXX.XXX.XXX" >> $COMMAND
echo "expect \"Name:\"" >> $COMMAND
echo "send \"www1\\r\"" >> $COMMAND
echo "expect \"Password:\"" >> $COMMAND
#echo "sleep 40" >> $COMMAND
echo "send \"passphase\\r\"" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"lcd $LOCALDIR\\r\"" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"cd $REMOTE_ADD\\r\"" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"get $DATAFILE\\r\"" >> $COMMAND
#echo "sleep 500" >> $COMMAND
echo "set timeout -1" >> $COMMAND
echo "expect \"ftp>\"" >> $COMMAND
echo "send \"bye\\r\"" >> $COMMAND
#echo "sleep 120" >> $COMMAND
echo exit >> $COMMAND
chmod 755 $COMMAND
$COMMAND
ENDTIME=`date '+%s'`
echo "Total Time taken `expr $ENDTIME - $STARTTIME` Seconds"
#!/usr/bin/expect --
cat $FILE> VISIT_LOG_BIG
[oracle@localhost visitor_log]$
47 01 * * * sh /data1/oracle/dilip/visit_log/cmd12.sh
No comments:
Post a Comment