You are not logged in.

#1 18 Sep 2011 21:51

sarbjitsinghgill
Member
From: TORONTO CANADA
Registered: 09 Dec 2007
Posts: 112
Website

Transfer files to remote Linux system

Can some one suggest me a simplest  way to transfer a text file from one linux to another.
This file will be transfered everyday at 12:10 am which will be analyzed by a tool at target system.

This has to be scripted .

Thanks in advance.


Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

Offline

#2 02 Nov 2011 07:29

ramesh.subbu.2005
Member
From: ECIL
Registered: 01 Nov 2011
Posts: 6

Re: Transfer files to remote Linux system

U can use ftp


script start :-
------------

#!/bin/sh

if [ $# -lt 5 ] ; then
echo "Usage: EXENAME IP USER PASSWD REMOTEDIR REMOTEFILE"
exit 0;
fi

currentdate=`date +"%Y%m%d"`
yesterdaydate=`date +"%Y%m%d" --date="yesterday"`

echo $currentdate
echo $yesterdaydate

#HOST='192.168.1.63'
#USER='root'
#PASSWD='packet143.'
#FILE='file.txt'

HOST=$1
USER=$2
PASSWD=$3
DIR=$4
FILE=$5

ftp -in $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd $DIR
put $FILE
get $FILE
quit
END_SCRIPT

exit 0

------------
end of script



in this script u have to put in crontab

enter the linux terminal or console
crontab -e

10 0 * * * script.sh

Ramesh Pasunoori

Offline

#3 02 Nov 2011 18:13

sarbjitsinghgill
Member
From: TORONTO CANADA
Registered: 09 Dec 2007
Posts: 112
Website

Re: Transfer files to remote Linux system

Thanks again,
I had this going with scp, no problems.
scp is available on all , I doubt, here are many without FTP.

The script used for scp, thanks.


Sarbjit


Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

Offline

Board footer

Powered by