Hi All,
I have several zip files(under /export/home/ftp/siac/*.zip) on one machine called arbitrage and my goal is to transfer this file from arbitrage to lenbkx0001 (under lenbkx0001:/nb_apps/dev/ashish/proj/datafiles) which is other machine. And lenbkx0001 I have perl script which reads this file and do some task as a background process and if everything is ok then do all process after five minutes again.
I wrote two small .ksh shell script one for file transfer from arbitrage machine to lenbkx0001 and this script is on arbitrage machine and other .ksh shell script is calling perl program and this script is on lenbkx0001 machine. Both scripts are very straight forward. But some how these scripts are not working. And main idea is that it should run after every 5 minutes so I used at UNIX command. I put my both ksh script here:
Script 1: Arbitrage machine ksh shell script:
#! /usr/bin/ksh -f
# if rcp success then remove the zip file
rcp /export/home/ftp/siac/*.zip lenbkx0001:/nb_apps/dev/ashish/proj/datafiles
rm -f /export/home/ftp/siac/*.zip 2>> /var/tmp/runRcpLog 1>&2
at -k -f $HOME/runRcp.ksh now + 5minutes 2>> /var/tmp/runRcpLog 1>&2
script 2: on lenbkx0001 machine
#! /usr/bin/ksh -f
cd $BASE_DIR/proj/datafiles
filelist=`ls | grep zip`
#ls -la
#`pwd`
#echo ${filelist}
for filename in $filelist
do
if [ ! -a $BASE_DIR/proj/datafiles/${filename} ]
then
echo "there is no zip file exist." 2>> /var/tmp/runCronJobLog 1>&2
at -k -f $BASE_DIR/proj/runCronJob.ksh now + 5minutes 2>> /var/tmp/runCronJobLog 1>&2
else
nohup perl $BASE_DIR/proj/apps/testprod.pl 2>> /var/tmp/runCronJobLog 1>&2
mv -f $BASE_DIR/proj/datafiles/${filename} /data/factor-files
at -k -f $BASE_DIR/proj/runCronJob.ksh now + 5minutes 2>> /var/tmp/runCronJobLog 1>&2
fi
done
Please e-mail me on ashah4@hotmail.com
Thanks,
A
I have several zip files(under /export/home/ftp/siac/*.zip) on one machine called arbitrage and my goal is to transfer this file from arbitrage to lenbkx0001 (under lenbkx0001:/nb_apps/dev/ashish/proj/datafiles) which is other machine. And lenbkx0001 I have perl script which reads this file and do some task as a background process and if everything is ok then do all process after five minutes again.
I wrote two small .ksh shell script one for file transfer from arbitrage machine to lenbkx0001 and this script is on arbitrage machine and other .ksh shell script is calling perl program and this script is on lenbkx0001 machine. Both scripts are very straight forward. But some how these scripts are not working. And main idea is that it should run after every 5 minutes so I used at UNIX command. I put my both ksh script here:
Script 1: Arbitrage machine ksh shell script:
#! /usr/bin/ksh -f
# if rcp success then remove the zip file
rcp /export/home/ftp/siac/*.zip lenbkx0001:/nb_apps/dev/ashish/proj/datafiles
rm -f /export/home/ftp/siac/*.zip 2>> /var/tmp/runRcpLog 1>&2
at -k -f $HOME/runRcp.ksh now + 5minutes 2>> /var/tmp/runRcpLog 1>&2
script 2: on lenbkx0001 machine
#! /usr/bin/ksh -f
cd $BASE_DIR/proj/datafiles
filelist=`ls | grep zip`
#ls -la
#`pwd`
#echo ${filelist}
for filename in $filelist
do
if [ ! -a $BASE_DIR/proj/datafiles/${filename} ]
then
echo "there is no zip file exist." 2>> /var/tmp/runCronJobLog 1>&2
at -k -f $BASE_DIR/proj/runCronJob.ksh now + 5minutes 2>> /var/tmp/runCronJobLog 1>&2
else
nohup perl $BASE_DIR/proj/apps/testprod.pl 2>> /var/tmp/runCronJobLog 1>&2
mv -f $BASE_DIR/proj/datafiles/${filename} /data/factor-files
at -k -f $BASE_DIR/proj/runCronJob.ksh now + 5minutes 2>> /var/tmp/runCronJobLog 1>&2
fi
done
Please e-mail me on ashah4@hotmail.com
Thanks,
A