Networker

Re: [Networker] Scripting help

2011-12-07 08:22:35
Subject: Re: [Networker] Scripting help
From: Michael Leone <Michael.Leone AT PHA.PHILA DOT GOV>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Wed, 7 Dec 2011 08:20:33 -0500
> It's been a long time since I have done batch scripting .... and 
> what I do remember from it, is that its really limited in what you can 
do ...
> 
> You can't have nested for loops, 

You can call a subroutine or a separate batch file from within a loop to 
get around that.

(you are speaking of Windows Command files, right?)

> there is some restriction around being able to set a variable inside a 
for loop

You can't re-set the index counter inside the loop, but you can set other 
variables within a loop, sure.

FOR /F "TOKENS=1-4 DELIMS=/ " %%I IN ('DATE /T') DO (
        SET DayOfWeek=%%I
        SET Month=%%J
        SET Day=%%K
        SET Year=%%L
)

> ... other than the tokens defined in the loop.
> 
> I haven't tested the script below, but you could possibly break it 
> out into something like below 
> 
> jsrjb >nsrjb.out
> FOR /F %%A IN ('mminfo -q "client=client_name,savetime>=today" -ot -
> r barcode') DO
>   type nsrjb.out | find /i "%%A" >>tapelist.out
> 
> FOR /F %%A IN ('type tapelist.out') DO
>   nsrmm -o readonly "%%A"
> 
> 
> 
> Mat 
> 
> 
> -----Original Message-----
> From: EMC NetWorker discussion [mailto:NETWORKER AT LISTSERV.TEMPLE DOT EDU
> ] On Behalf Of tlamana
> Sent: Wednesday, 7 December 2011 4:21 AM
> To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
> Subject: [Networker] Scripting help
> 
> How can this script:
> 
> FOR /F %%A IN ('mminfo -q "client=client_name,savetime>=today" -ot -
> r barcode') DO FOR /F "skip=3 tokens=1,2,3 delims=: " %%B IN 
> ('nsrjb') DO IF %%A==%%C match.bat %%B %%A
> 
> be stripped down to just search for volumenames then insert the 
> volumename into: nsrmm -o readonly "volumename"?
> 
> 
> There will only be two tapes for any given day so I am thinking that
> the nsrmm command would have to be listed twice.
> 
> +----------------------------------------------------------------------
> |This was sent by tlamana AT saddlewest DOT com via Backup Central.
> |Forward SPAM to abuse AT backupcentral DOT com.
> +----------------------------------------------------------------------
> 
> To sign off this list, send email to listserv AT listserv.temple DOT edu 
> and type "signoff networker" in the body of the email. Please write 
> to networker-request AT listserv.temple DOT edu if you have any problems 
> with this list. You can access the archives at http://
> listserv.temple.edu/archives/networker.html or via RSS at http://
> listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER
> 
> 
*********************************DISCLAIMER*********************************
> 
> 
> The information contained in the above e-mail message or messages
> (which includes any attachments) is confidential and may be legally
> privileged. It is intended only for the use of the person or entity
> to which it is addressed. If you are not the addressee any form of
> disclosure, copying, modification, distribution or any action taken
> or omitted in reliance on the information is unauthorised. Opinions
> contained in the message(s) do not necessarily reflect the opinions
> of the Queensland Government and its authorities. If you received
> this communication in error, please notify the sender immediately
> and delete it from your computer system network.
> 
> To sign off this list, send email to listserv AT listserv.temple DOT edu 
> and type "signoff networker" in the body of the email. Please write 
> to networker-request AT listserv.temple DOT edu if you have any problems 
> with this list. You can access the archives at http://
> listserv.temple.edu/archives/networker.html or
> via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

To sign off this list, send email to listserv AT listserv.temple DOT edu and 
type "signoff networker" in the body of the email. Please write to 
networker-request AT listserv.temple DOT edu if you have any problems with this 
list. You can access the archives at 
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

<Prev in Thread] Current Thread [Next in Thread>