Results 1 to 4 of 4
Dear All,
Every week i have to download some files from ftp server and copied into offshore Server(Suse Linux) file system. For this task i have to spend more than ...
- 08-27-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 7
Cron Jobs in a weekly schedule
Dear All,
Every week i have to download some files from ftp server and copied into offshore Server(Suse Linux) file system. For this task i have to spend more than 4 hours in a week.
So I am planning to put a cron job for downloading files from ftp and put/replace directly into our offshore server.
I am new in cron jobs.
Please help me to do that.
Thanks in advance,
Moorthy.GS
- 08-27-2007 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
First you should read up on crontab:
man crontab
man 5 crontab
man 1 crontab
Now let's say you have a script /home/user/ftp.sh and you want to run it every Monday evening at 10 PM. The crontab entry would look like:
00 22 * * 1 /home/user/ftp.sh > /home/user/ftp.log 2>&1
This will run script ftp.sh and put all output from stdout & stderr in ftp.log.
Vic
- 08-27-2007 #3Just Joined!
- Join Date
- Aug 2007
- Posts
- 7
Hey Vic,
Thanks for your reply...
Kindly give me sample script for connecting ftp and get the files from that.
Also how to write a cron job for that operation.
Thanks,
Moorthy.GS
- 08-27-2007 #4Linux User
- Join Date
- Jun 2007
- Posts
- 318
The script /home/user/ftp.sh could look something like this:
Replace 'host-name', 'username', 'password', & 'filename' with the appropriate values.Code:#!/bin/bash -vx ftp -in host-name<<END_SCRIPT quote USER username quote PASS password bin mget filename bye END_SCRIPT
Then do '# crontab -e' and add that crontab entry.
Vic


Reply With Quote