| John Pretti 2004-05-21, 11:33 am |
| All,
I have been assigned the task of promoting files from one server to another.
I have broken this down into two components: file upload and then the actual
file promotion. I have a great upload script that I have developed with you
all's assistance but now I am kind of stuck. Basically I have a form
generated by CGI that will prompt the user for a directory selection and
when they press the Promote button it would copy the files from the local
server to a specific directory on three remote servers. I understand what I
need to do and the components that I want to use (Net::SCP), but I still am
having trouble understanding the logic and what the best way to do it would
be. Any help would be greatly appreciated. The code that I have is listed
below:
#!/usr/bin/perl -w
# perlPromote.cgi by John Pretti
# Comments/Questions john[at]web-connected.com
# Last modified 05/17/04
# Load needed Perl modules
use strict;
use diagnostics;
use CGI; #Make HTML east to deal with
use CGI::Carp 'fatalsToBrowser'; # Report errors to Browser
# Promotion directories
my @rem_hosts = ('x.x.x.x', 'y.y.y.y', 'z.z.z.z');
$working_dir = "/home/rdwebadmin/support_docs";
my @rem_dirs = ('HW', 'NW', 'SW');
my @sub_rem_dirs = ('/SW/Unifi', '/SW/MFIS', '/SW/WEBCAAF_eforms');
# Create New CGI Object
my $q = new CGI;
my %label = ('hw'=>'..support_docs/HW',
'nw'=>'..support_docs/NW',
'sw'=>'..support_docs/SW',
'swmfis'=>'..support_docs/SW/MFIS',
'swunifi'=>'..support_docs/SW/Unifi',
'swwebcaaf'=>'..support_docs/SW/WEBCAAF_eforms');
print $q->header,
$q->start_html,
$q->br,
$q->start_multipart_form,
$q->p("Select a promotion directory:"),
$q->radio_group (
-name=>'promdir',
-values=>
& #91;'hw','nw','sw','swmfis','swunifi','s
wwebcaaf'],
-labels=>\%label,
-default=>'selected',
-linebreak=>'true'),
$q->br,
$q->submit('Promote'),
$q->end_form,
$q->end_html;
Thanks in advance. I am slowly starting to understand some of this.
John
|