SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Scripting help
Author Message
Post 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.

View user's profile Send private message
Post  
OK, I stripped it down to "mminfo -q "savetime>=today" and was able to list the two volumes that were written. The question would be how do you scrape the volume names so they can be inserted into the next command?

View user's profile Send private message
Post Scripting help 
In regard to: [Networker] Scripting help, tlamana said (at 10:32am on Dec...:

OK, I stripped it down to "mminfo -q "savetime>=today" and was able to
list the two volumes that were written. The question would be how do
you scrape the volume names so they can be inserted into the next
command?

Assuming you don't have spaces in your volume names, you should just
loop over the volume names and run nsrmm on each one.

I don't do Windows batch scripting, but on UNIX/Linux with a
Bourne-derived shell, it would be something like

for v in `mminfo -q 'savetime>=today' -r volume`
do
nsrmm -o readonly $v
done

I'll leave translating that to batch or PowerShell to you.

Tim
--
Tim Mooney Tim.Mooney < at > ndsu.edu
Enterprise Computing & Infrastructure 701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

View user's profile Send private message
Post Scripting help 
Hey,

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, there is some restriction around being able to set a variable inside a for loop ... 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.EDU] On Behalf Of tlamana
Sent: Wednesday, 7 December 2011 4:21 AM
To: NETWORKER < at > LISTSERV.TEMPLE.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.com via Backup Central.
|Forward SPAM to abuse < at > backupcentral.com.
+----------------------------------------------------------------------



*********************************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.


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

Post Scripting help 
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.EDU
] On Behalf Of tlamana
Sent: Wednesday, 7 December 2011 4:21 AM
To: NETWORKER < at > LISTSERV.TEMPLE.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.com via Backup Central.
|Forward SPAM to abuse < at > backupcentral.com.
+----------------------------------------------------------------------


and type "signoff networker" in the body of the email. Please write
to networker-request < at > listserv.temple.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.


and type "signoff networker" in the body of the email. Please write
to networker-request < at > listserv.temple.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


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

Post Scripting help 
Which script are you using, U can get only the volume information by using the "-r" switch.

Eg: mminfo -c <client_name> -t <time> -r volume

Rovin A. D'Souza

 Information transmitted by this e-mail is proprietary to MphasiS and/ or its Customers and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this Information in any manner is strictly prohibited. In such cases, please notify us immediately at mailmaster < at > mphasis.com and delete this mail from your record

-----Original Message-----
From: EMC NetWorker discussion [mailto:NETWORKER < at > LISTSERV.TEMPLE.EDU] On Behalf Of tlamana
Sent: Wednesday, December 07, 2011 12:02 AM
To: NETWORKER < at > LISTSERV.TEMPLE.EDU
Subject: [Networker] Scripting help

OK, I stripped it down to "mminfo -q "savetime>=today" and was able to list the two volumes that were written. The question would be how do you scrape the volume names so they can be inserted into the next command?

+----------------------------------------------------------------------
|This was sent by tlamana < at > saddlewest.com via Backup Central.
|Forward SPAM to abuse < at > backupcentral.com.
+----------------------------------------------------------------------


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

Post  
Can someone explain how the -x varible works on mminfo? Since I now have the volumes I am thinking the -x will export those to a file??

View user's profile Send private message
Post Scripting help 
On 12/13/11 5:49 PM, tlamana wrote:
Can someone explain how the -x varible works on mminfo? Since I now have the volumes I am thinking the -x will export those to a file??

-x is used to change the output that mminfo generates. if you use -xm,
it will generate xml output to your screen. If you use -xc<char> (for
example -xc,) it will use that <char> to separate the values -- easy way
to generate a comma separated value file to dump into a spreadsheet...

You must be on Windows and not be able to do "man mminfo"?

Frank

Post Scripting help 
On 12/13/11 5:49 PM, tlamana wrote:
Can someone explain how the -x varible works on mminfo? Since I now have the volumes I am thinking the -x will export those to a file??

-x is used to change the output that mminfo generates. if you use -xm,
it will generate xml output to your screen. If you use -xc<char> (for
example -xc,) it will use that <char> to separate the values -- easy way
to generate a comma separated value file to dump into a spreadsheet...

You must be on Windows and not be able to do "man mminfo"?

Frank


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

Post Scripting help 
On 13/12/11 22:49, tlamana wrote:
Can someone explain how the -x varible works on mminfo? Since I now have the volumes I am thinking the -x will export those to a file??


Why would you think that? Why would you just guess rather than reading
the documentation? If you are not fortunate enough to be working on a
Unix system where you have the benefit of man pages then you should
download the command references from Powerlink. Then you will have the
facts and not have to resort to guesswork.


via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB