LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-11-2003, 09:53 AM   #1
juanb
Member
 
Registered: May 2002
Posts: 401

Rep: Reputation: 30
Question wget command


hi !!
I need to use crontab to download a file and overright older file in my RH box

the ftp site is: f tp://212.199.10.11/Panda/PavSig/Pav.sig

and the file in my box sites in /usr/lib/panda/Pav.sig

what is the command to enter in crontab to do this ?


thanks very much !!!
 
Old 12-11-2003, 10:57 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Re: wget command

Quote:
Originally posted by juanb
what is the command to enter in crontab to do this ?
Well first create the script to run the wget command. You could do something simple to remove the existing file first and then download the latest files with something like this:
Code:
#!/bin/bash
#
# Script to download file everynight

cd /usr/lib/panda
rm -rf Pav.sig
wget -p -nH -nd  ftp://212.199.10.11/Panda/PavSig/Pav.sig

# End of Script
Save and make it executable with chmod +x <scriptname>

You will want to check the man pages for wget, I can't remember exactly but I think the command I gave above in the script should just download that one file, instead of grabbing all the links, creating the directories, etc.

Then in crontab you can just do this:

0 22 * * * /path/to/script

That would envoke the script to run every day at 10pm every day and every month.

You could or can also just add the wget command in crontab to grab the file, not sure if there is a overwrite option for wget, I'd check the man pages on:

wget
crontab
cron

For more details or options. Hope this helps get you started. I'm sure there are easier ways maybe, I'm just going out of my head right now..
 
Old 12-11-2003, 03:57 PM   #3
juanb
Member
 
Registered: May 2002
Posts: 401

Original Poster
Rep: Reputation: 30
thanks very much

whan I write the script in vi -what it the file expention that I need to set to this file in order it to be excutble?

thanks
 
Old 12-11-2003, 04:00 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally posted by juanb
thanks very much

whan I write the script in vi -what it the file expention that I need to set to this file in order it to be excutble?

thanks
Just copy and paste if you want. Save it then execute the chmod command to set the permissions.

You can name it whatever you want.

chmod +x <name of script>

I would test that wget command first though to see whether or not if downloads it correctly, etc.
 
Old 12-11-2003, 04:10 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
A bash script doesn't need any extensions like .txt or .doc

All you need is the name you choose to call it like maybe test

If you want to run that bash script called test then change to the directory and use the command: sh test
 
Old 12-11-2003, 04:23 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Note that if you read the wget manpage then you probably don't even need to write a script.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wget command question satimis Linux - Software 3 11-16-2004 07:01 AM
wget command help munkeevegetable Linux - Newbie 8 11-03-2004 07:37 PM
Wget command options help??? tekhead2 Linux - Software 1 06-23-2004 07:58 AM
wget command not found irs-away Linux - Newbie 4 09-07-2003 11:35 AM
wget command glock19 Linux - General 0 11-29-2001 03:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration