cancel
Showing results for 
Search instead for 
Did you mean: 

nbpemreq -predict script

chack22
Level 4
Not to keen on Windows scripting, so I'm hoping someone has done this before. Need to create a scheduled task that will email the output of nbpemreq -predict -date xx/xx/xx every day, but changing the date to 'todays' date each time it runs. Easy to do in solaris, but I can't find an easy way to do so in Windows. Any thoughts?
1 ACCEPTED SOLUTION

Accepted Solutions

Mark_Solutions
Level 6
Partner Accredited Certified

To get the date you need to use the variables - pick them from this string which will put the date, time and seconds in for you, all seperated by underscores

You should be able to work out what is what from this so use the parts you want:

%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,2%

So the above gives 20131128_103247 (the last part is 10.32 and 47 seconds)

As you need it in the format mm/dd/yyyy you will actually need to use:

%date:~7,2%/%date:~0,2%/%date:~4,4% in your command when viweing but extra to pipe out - giving you:

nbpemreq -predict -date %date:~-7,2%/%date:~0,2%/%date:~-4,4% >c:\predict_%date:~-4,4%%date:~-7,2%%date:~0,2%.txt

This outputs to a predict_20131128.txt file (well it does today anyway!)

You still need blat to then send the file to email but can just do that on a second line and then put both in a .bat file

So final should be - if you put this in a predict.bat - this cleans up yesterdays file first

del c:\predict*.txt

nbpemreq -predict -date %date:~-7,2%/%date:~0,2%/%date:~-4,4% >c:\predict_%date:~-4,4%%date:~-7,2%%date:~0,2%.txt

Blat c:\predict*.txt -s "nbpemreq predict" -t foo@bar.com

 

Hope this helps

 

#edit#

if you dont have paths setup you need to add the path to nbpem req:

"c:\program files\veritas\netbackup\bin\admincmd\nbpemreq" -predict ........

View solution in original post

4 REPLIES 4

rk1074
Level 6
Partner

Put the command in a text file and rename the file as jobs_predict.bat .

Then schedule a task using a task scheduler "http://windows.microsoft.com/en-sg/windows7/schedule-a-task{C}"

Rememer U will need to have the windows mailing cient ( like blat ) inorder to get the emails  

Mark_Solutions
Level 6
Partner Accredited Certified

To get the date you need to use the variables - pick them from this string which will put the date, time and seconds in for you, all seperated by underscores

You should be able to work out what is what from this so use the parts you want:

%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,2%

So the above gives 20131128_103247 (the last part is 10.32 and 47 seconds)

As you need it in the format mm/dd/yyyy you will actually need to use:

%date:~7,2%/%date:~0,2%/%date:~4,4% in your command when viweing but extra to pipe out - giving you:

nbpemreq -predict -date %date:~-7,2%/%date:~0,2%/%date:~-4,4% >c:\predict_%date:~-4,4%%date:~-7,2%%date:~0,2%.txt

This outputs to a predict_20131128.txt file (well it does today anyway!)

You still need blat to then send the file to email but can just do that on a second line and then put both in a .bat file

So final should be - if you put this in a predict.bat - this cleans up yesterdays file first

del c:\predict*.txt

nbpemreq -predict -date %date:~-7,2%/%date:~0,2%/%date:~-4,4% >c:\predict_%date:~-4,4%%date:~-7,2%%date:~0,2%.txt

Blat c:\predict*.txt -s "nbpemreq predict" -t foo@bar.com

 

Hope this helps

 

#edit#

if you dont have paths setup you need to add the path to nbpem req:

"c:\program files\veritas\netbackup\bin\admincmd\nbpemreq" -predict ........

View solution in original post

rk1074
Level 6
Partner

Thanks Mark for the script description. :)

chack22
Level 4

This was helpful and pointed me in the right direction. Thank you.