Results 1 to 2 of 2
Dear All,
Please to be inform you,I have posted one thread on this forum last 5 days back. I was not getting suggestions for my thread. So i am creating ...
- 09-10-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 7
Cron Jobs for FTP download
Dear All,
Please to be inform you,I have posted one thread on this forum last 5 days back. I was not getting suggestions for my thread. So i am creating a new thread with detailed of my R&D.
I am new in Shell Scripts, Perl and Cron Jobs. I have one requirement in Cron jobs for FTP Download. Presently i am
downloading around 600 MB files from ftp server manually in every monday. This will affect our internet bandwidth
during office hours. For avioding this, i am planning to schedule cron jobs for my download process.
Download Process to be performed in SUSE Linux. Becoz Downloaded files to be replaced into that server only.
My requirement,
1) I have to stop my server before start the download process. I have given below scripts for stop server process
manually.
login as endeca
password end123
a)endeca# . .endeca_apt
b)endeca# cd bin/
c)endeca/bin# RunCommand apt_control.script apt_stop
a)endeca# . .endeca_auto
b)endeca# cd bin/
c)endeca/bin# RunCommand auto_control.script auto_stop
a)endeca# . .endeca_chrome
b)endeca# cd bin/
c)endeca/bin# RunCommand chrome_control.script chrome_stop
a)endeca# . .endeca_babe
b)endeca# cd bin/
c)endeca/bin# RunCommand babe_control.script babe_stop
How can i write scripts with should be stopped my server process in differnt user?
2) I have to download files from four source folders Like /Source/Dumps1/*, /Source/Dumps2/*, /Source/Dumps2/*,
/Source/Dumps2/*. This will possible on root user only.
FTP Host is 10.10.10.100 port 21
user abc
password defgh
3) Downloaded files are replaced into my Destination folder like /space/endeca/apt/, /space/endeca/auto/,
/space/endeca/chrome/, /space/endeca/babe/ - This will possible on root user only. Is there need to delete the old
files in that four folders?
4) Once Files are moved into destination path. I have to change the ownership of that files like below
root# chown endeca:endeca /space/endeca/apt
root# chown endeca:endeca /space/endeca/auto
root# chown endeca:endeca /space/endeca/chrome
root# chown endeca:endeca /space/endeca/babe
5) Once change ownership is over, i have to restart the server process
login as endeca
password end123
a)endeca# . .endeca_apt
b)endeca# ./start_em.sh
c)endeca# cd bin/
d)endeca/bin# RunCommand apt_control.script apt_start
a)endeca# . .endeca_auto
b)endeca# ./start_em.sh
c)endeca# cd bin/
d)endeca/bin# RunCommand auto_control.script auto_start
a)endeca# . .endeca_chrome
b)endeca# ./start_em.sh
c)endeca# cd bin/
d)endeca/bin# RunCommand chrome_control.script chrome_start
a)endeca# . .endeca_babe
b)endeca# ./start_em.sh
c)endeca# cd bin/
d)endeca/bin# RunCommand babe_control.script babe_start
I have written ftp scripts for download. My doubt is i have to write four script for downloading four folders. Also
i have to schedule four cron jobs for my tasks.
#!/bin/bash -vx
ftp -in 10.10.10.100<<END_SCRIPT
quote USER abc
quote PASS defgh
bin
prompt off
cd /Source/Dumps1/
lcd /space/endeca/apt/
mget *
bye
END_SCRIPT
Please guide me to my R&D.
Thanks in advance,
Moorthy.GS
- 09-11-2007 #2Just Joined!
- Join Date
- Aug 2007
- Posts
- 7
Cron Jobs for FTP Download
Dear All,
Hope my thread is getting bore to read it. Now i tried to write a shell script for my R&D and scheduled it through cron jobs. Below my code...
#!/bin/bash -vx
ftp -in 10.10.10.100<<END_SCRIPT
quote USER abc
quote PASS abcded
bin
prompt off
cd /csi/endeca_chrome/dgraph_input/
lcd /home/endeca/chrome/
mget *
cd ..
cd /csi/endeca_autos/dgraph_input/
lcd /home/endeca/autos/
mget *
cd ..
cd /csi/endeca_babe/dgraph_input/
lcd /home/endeca/babe/
mget *
cd ..
cd /csi/endeca_apt/dgraph_input/
lcd /home/endeca/babe/
mget *
bye
END_SCRIPT
I have scheduled last night 2 AM for my download process. Here below crontab entries....
00 02 * * 2 /root/ftp.sh > /root/ftp.log 2>&1
But only 3 files copied to /home/endeca/chrome/ location.
I have pasted my ftp.log entries for your reference. Please help me to fix it.
#!/bin/bash -vx
ftp -in 216.251.248.151<<END_SCRIPT
+ ftp -in 216.251.248.151
Interactive mode off.
Local directory now /home/endeca/chrome
'EPSV': command not understood
Cheers,
Moorthy.GS


Reply With Quote