Re: ftp from script

2009-01-04 Thread Ed Ahlsen-Girard
Thanks to all. The below worked. Grab the snapshots: #!/usr/bin/perl use Net::FTP; unlink /home/ed/snap/*; my $host = 'rt.fm'; my $ftp = Net::FTP-new($host, Debug =0) or die Cannot connect to $host: $0; $ftp-login(anonymous,'-anonymous@') or die Cannot login ,

Re: ftp from script

2009-01-04 Thread Randal L. Schwartz
Ed == Ed Ahlsen-Girard eagir...@cox.net writes: Ed #!/bin/sh Ed export cvsroot=anon...@rt.fm:/cvs Ed cd /usr Ed cvs checkout -P src Ed date You still haven't learned to check the return value of cd. :) That should be: cd /usr || exit 1 -- Randal L. Schwartz - Stonehenge Consulting

Re: ftp from script

2009-01-04 Thread Markus Lude
On Sun, Jan 04, 2009 at 07:03:38AM -0600, Ed Ahlsen-Girard wrote: Thanks to all. The below worked. Grab the snapshots: [...] Update source: #!/bin/sh export cvsroot=anon...@rt.fm:/cvs cd /usr cvs checkout -P src Why not use cvs update? Of course you need to chdir to /usr/src

Re: ftp from script

2009-01-03 Thread Ed Ahlsen-Girard
Randal L. Schwartz wrote: Daniel == Daniel A Ramaley daniel.rama...@drake.edu writes: Daniel chdir /path-to-dir; You didn't check the success of the chdir. This will ruin your original current directory if that fails... Daniel unlink *; Oops! The proper solution

Re: ftp from script

2009-01-03 Thread johan beisser
On Jan 3, 2009, at 7:27 AM, Ed Ahlsen-Girard wrote: You're right. You're so right, in fact, that I'd already changed the code; even I noticed that my original was bad practice. You're doing this in perl, and not using Net::FTP? But my real problem was getting the download to work inside a

Re: ftp from script

2009-01-03 Thread Philip Guenther
On Sat, Jan 3, 2009 at 7:27 AM, Ed Ahlsen-Girard eagir...@cox.net wrote: ... But my real problem was getting the download to work inside a script, and none of the presented ideas so far have helped that. Perhaps you should actually show the complete output from one that succeeds and then again

Re: ftp from script

2009-01-03 Thread eagirard
johan beisser j...@caustic.org wrote: On Jan 3, 2009, at 7:27 AM, Ed Ahlsen-Girard wrote: You're right. You're so right, in fact, that I'd already changed the code; even I noticed that my original was bad practice. You're doing this in perl, and not using Net::FTP? I'm

Re: ftp from script

2009-01-03 Thread Karl Karlsson
2009/1/3 eagir...@cox.net: johan beisser j...@caustic.org wrote: On Jan 3, 2009, at 7:27 AM, Ed Ahlsen-Girard wrote: You're right. You're so right, in fact, that I'd already changed the code; even I noticed that my original was bad practice. You're doing this in perl, and not

Re: ftp from script

2009-01-03 Thread Ed Ahlsen-Girard
Philip Guenther wrote: On Sat, Jan 3, 2009 at 7:27 AM, Ed Ahlsen-Girard eagir...@cox.net wrote: ... But my real problem was getting the download to work inside a script, and none of the presented ideas so far have helped that. Perhaps you should actually show the complete output

Re: ftp from script

2009-01-03 Thread Ed Ahlsen-Girard
Karl Karlsson wrote: 2009/1/3 eagir...@cox.net: johan beisser j...@caustic.org wrote: On Jan 3, 2009, at 7:27 AM, Ed Ahlsen-Girard wrote: You're right. You're so right, in fact, that I'd already changed the code; even I noticed that my original was bad practice.

Re: ftp from script

2009-01-03 Thread Karl Karlsson
2009/1/3 Ed Ahlsen-Girard eagir...@cox.net: Philip Guenther wrote: On Sat, Jan 3, 2009 at 7:27 AM, Ed Ahlsen-Girard eagir...@cox.net wrote: ... But my real problem was getting the download to work inside a script, and none of the presented ideas so far have helped that. Perhaps you should

Re: ftp from script

2009-01-03 Thread Randal L. Schwartz
Ed == Ed Ahlsen-Girard eagir...@cox.net writes: Ed #!/usr/bin/perl Ed `cd /home/ed/snap`; This doesn't do anything, except waste time. May I suggest a good book or two for learning perl, so you won't keep wasting time on this? :) Might be a good way to learn to check return values as well.

Re: ftp from script

2009-01-03 Thread Adriaan
On Sat, Jan 3, 2009 at 4:27 PM, Ed Ahlsen-Girard eagir...@cox.net wrote: But my real problem was getting the download to work inside a script, and none of the presented ideas so far have helped that. A simple shell alternative maybe? -

Re: ftp from script

2009-01-02 Thread Randal L. Schwartz
Daniel == Daniel A Ramaley daniel.rama...@drake.edu writes: Daniel chdir /path-to-dir; You didn't check the success of the chdir. This will ruin your original current directory if that fails... Daniel unlink *; Oops! The proper solution is rmtree, a function defined in File::Path:

ftp from script

2008-12-31 Thread Ed Ahlsen-Girard
I'm trying to automate getting the sets and source for running -current. For some reason, this syntax: ftp -ia ftp://host.domain/pub/OpenBSD/snapshots/architecture/*.tgz or this: ftp -ia ftp://host.domain/pub/OpenBSD/snapshots/architecture/bsd.rd works great from the command line. But not

Re: ftp from script

2008-12-31 Thread Lars Noodén
Ed Ahlsen-Girard wrote: Anybody have an idea of what I'm missing? How is $PATH set? Do the scripts work if you include the full path? i.e. /usr/bin/ftp Regards, -Lars

Re: ftp from script

2008-12-31 Thread Jesus Sanchez
this works for me, recheck your install, or otherwise try to compile ftp again from sources. -Jesus Ed Ahlsen-Girard escribis: I'm trying to automate getting the sets and source for running -current. For some reason, this syntax: ftp -ia

Re: ftp from script

2008-12-31 Thread Han Boetes
Ed Ahlsen-Girard wrote: I'm trying to automate getting the sets and source for running -current. Incase you don't want to reinvent the wheel: http://www.xs4all.nl/~hanb/software/OpenBSD-binary-upgrade/ # Han

Re: ftp from script

2008-12-31 Thread Frank Bax
Ed Ahlsen-Girard wrote: `ftp -ia ftp://host.domain/pub/OpenBSD/snapshots/architecture/*.tgz`; Using system () does not get any different behavior, whether I pass a list or a proper array. In all cases I see a connection to the server, followed by a complaint of an invalid directory, and

Re: ftp from script

2008-12-31 Thread Christoph Leser
`cd /path-to-dir;rm *`; Regards Christoph Von: owner-m...@openbsd.org im Auftrag von Ed Ahlsen-Girard Gesendet: Mi 31.12.2008 13:27 An: misc@openbsd.org Betreff: ftp from script I'm trying to automate getting the sets and source for running -current. For some

Re: ftp from script

2008-12-31 Thread eagirard
Betreff: ftp from script I'm trying to automate getting the sets and source for running -current. For some reason, this syntax: ftp -ia ftp://host.domain/pub/OpenBSD/snapshots/architecture/*.tgz or this: ftp -ia ftp://host.domain/pub/OpenBSD/snapshots/architecture/bsd.rd works

Re: ftp from script

2008-12-31 Thread bofh
On Wed, Dec 31, 2008 at 9:42 AM, Christoph Leser le...@sup-logistik.de wrote: Just my 1 cent on the perl script #!/usr/bin/perl `cd /path-to-dir`: `rm *`; will purge your working directory, not /path-to-dir, as each of the `command` constructs is executed in a process of its own and thus

Re: ftp from script

2008-12-31 Thread eagirard
On Wed, Dec 31, 2008 at 9:42 AM, Christoph Leser le...@sup-logistik.de wrote: Just my 1 cent on the perl script #!/usr/bin/perl `cd /path-to-dir`: `rm *`; will purge your working directory, not /path-to-dir, as each of the `command` constructs is executed in a process of its

Re: ftp from script

2008-12-31 Thread Daniel A. Ramaley
On Wednesday December 31 2008 13:34, you wrote: On Wed, Dec 31, 2008 at 9:42 AM, Christoph Leser le...@sup-logistik.de wrote: #!/usr/bin/perl `cd /path-to-dir`: `rm *`; You shouldn't be using backticks in a perl script. Backtick simply starts a new process/subshell and runs whatever you have