Re: [Networker] How can I do this in perl?
2004-11-14 04:47:24
George,
Somethink like that should achieve what
you are trying to do :
$BACKUP_SERVER=${ARGV[0]};
$TYPE=${ARGV[1]};
$NAME=${ARGV[2]};
open (QUERY, ">${BACKUP_SERVER}.tmp") || die "Cannot open '$cmd',$!";
print QUERY "show ";
print QUERY "print type:nsr $TYPE; name: $NAME";
close QUERY;
system ("nsradmin -s ${BACKUP_SERVER} -i ${BACKUP_SERVER}.tmp >
${BACKUP_SERVER}.log");
open(REPORT,"$cmd1 |" ) || die "Cannot open '$cmd1',$!";
while (<REPORT>) {
print $_
}
close REPORT;
Have fun,
Th
Kind regards - Bien cordialement - Vriendelijke groeten,
Thierry FAIDHERBE
HP Services - Storage Division
Tru64 Unix and Legato Enterprise Backup Solutions Consultant
********* ********* HEWLETT - PACKARD
******* h ******* 1 Rue de l'aeronef/Luchtschipstraat
****** h ****** 1140 Bruxelles/Brussel/Brussels
***** hhhh pppp *****
***** h h p p ***** 100/102 Blv de la Woluwe/Woluwedal
***** h h pppp ***** 1200 Bruxelles/Brussel/Brussels
****** p ****** BELGIUM
******* p *******
********* ********* Phone : +32 (0)2 / 729.85.42
Mobile : +32 (0)498/ 94.60.85
Fax : +32 (0)2 / 729.88.30
I N V E N T Email/MSN : thierry.faidherbe AT hp DOT com
Internet : http://www.hp.com/
________________________________________________________________________
MOBISTAR SA/NV
CSO/CTO/CEO/SSD/SBI
SYSTEM Team Charleroi, Mermoz 2 Phone : +32 (0)2 / 745.75.81
Avenue Jean Mermoz, 32 Fax : +32 (0)2 / 745.89.56
6041 GOSSELIES Email : tfhaidhe AT mail.mobistar DOT be
BELGIUM Web : http://www.mobistar.be/
________________________________________________________________________
-----Original Message-----
From: Legato NetWorker discussion [mailto:NETWORKER AT LISTMAIL.TEMPLE DOT EDU]
On Behalf Of George Sinclair
Sent: Wednesday, November 10, 2004 11:55 PM
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Subject: [Networker] How can I do this in perl?
How can I do the equivalent of this shell script in perl?
#!/bin/sh
/usr/sbin/nsradmin -s server -i <<EOF
. type: NSR $1; name: $2
print
EOF
where I'm just printing out the info to standard output and $1 and $2
are passed to the script and would be something like 'client' and
'client_name', or 'group' and 'group_name', etc. I tried all kinds of
open commands with pipes, etc. Nothing seems to work.
Thanks.
George
--
Note: To sign off this list, send a "signoff networker" command via
email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list. Questions regarding this list
should be sent to stan AT temple DOT edu
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list. Questions regarding this list
should be sent to stan AT temple DOT edu
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
|
|