LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 09-23-2008, 03:03 PM   #1
investmentbnker75
Member
 
Registered: Oct 2007
Location: Eastern Seaboard
Distribution: CentOS
Posts: 162

Rep: Reputation: 15
automating wget


I am using a script with wget to get files off a server and put them in a directory on my server. I have two questions:

1. Does anyone know of an option i can add to this script to delete the files on the remote server after wget runs?

2. Does anyone know how i can create the same script on the remote server to put the files on the dest. server with wget. Then i can just add a line to rm the files.

Here is what i have on the dest server that automates wget.

#!/bin/sh

cd /home/userid/
wget ftp://userasswd@remoteIP:21/*.tgz
 
Old 09-23-2008, 04:31 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
For (2) you could look into some type of ftp agent, but I can't recommend one in particular.

Is there some reason why you couldn't use something like rsync in its place?
 
Old 09-23-2008, 09:45 PM   #3
investmentbnker75
Member
 
Registered: Oct 2007
Location: Eastern Seaboard
Distribution: CentOS
Posts: 162

Original Poster
Rep: Reputation: 15
Too much to set up. I have the wget script written, i just am looking for that last line to do the delete.
 
Old 09-23-2008, 10:23 PM   #4
timothyb89
Member
 
Registered: Jul 2006
Location: Colorado, USA
Distribution: openSuSE 11.4
Posts: 118

Rep: Reputation: 15
Try the wget option --remote-delete
It looks like it was added in 2007, so any recent version of wget should have it.

Edit: looks like my wget doesn't have it. If yours doesn't and you have SSH access to the machine, you might try running RM remotely, for example:
ssh user@host "rm /path/to/directory/*.tgz"

Last edited by timothyb89; 09-23-2008 at 10:28 PM.
 
Old 09-23-2008, 10:28 PM   #5
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370

Rep: Reputation: 35
'wget --delete-after' will delete a file or files after download

see: http://www.gnu.org/software/wget/man...getrc-Commands

Last edited by AuroraCA; 09-23-2008 at 10:43 PM. Reason: Correction: This operation only deletes files on local machine
 
Old 09-24-2008, 07:33 AM   #6
investmentbnker75
Member
 
Registered: Oct 2007
Location: Eastern Seaboard
Distribution: CentOS
Posts: 162

Original Poster
Rep: Reputation: 15
Aurora read the man page before making a suggestion like that, that option only works on the local machine not the remote...newbies
 
Old 09-24-2008, 07:43 AM   #7
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370

Rep: Reputation: 35
investmentbnker75

Read my post more carefully. I made a correction to my post well before your scolding post which points this out.

Watch your Internet manners.
 
  


Reply



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 not working! but "man wget is" ??? wrapster Solaris / OpenSolaris 5 07-30-2008 03:00 AM
Automating installs ? carcassonne SUSE / openSUSE 2 07-01-2006 11:04 AM
automating dialup rlucas Linux - Networking 1 08-07-2004 08:06 PM
automating processes fisheromen1031 Linux - Newbie 1 07-22-2004 12:15 AM
Automating modprobe? r_jensen11 Linux - Hardware 3 09-07-2003 08:30 PM

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

All times are GMT -5. The time now is 10:58 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