[chef] Re: Converting batch script to chef


Chronological Thread 
  • From: Sachin Gupta < >
  • To: Kenneth Barry < >
  • Cc: " " < >
  • Subject: [chef] Re: Converting batch script to chef
  • Date: Wed, 14 Jan 2015 08:54:24 +0530

This portion of code in batch will search for any instance with c:/ in pagefileset  list and based on the output will eitther set CurrentInitialPagingFileSizeMBC/CurrentMaximumPagingFileSizeMBC or goto another label
FindCurrentPagingFileSettingsP.

In my current environment, there are two instances of pagefile one in c: and another in p:

Thanks
Sachin

On Tue, Jan 13, 2015 at 8:18 PM, Kenneth Barry < " target="_blank"> > wrote:
Can you tell us in lay mans terms what that script accomplishes? There is a chance this is either done in another cookbook, or it would be better to create an lwrp.

Sent from my iPhone

> On Jan 13, 2015, at 6:15 AM, Sachin Gupta < "> > wrote:
>
> Hello,
>
>  I am trying to convert a windows batch script into chef script.  The sample  code is like below
>
> :FindCurrentPagingFileSettingsC
>     wmic pagefileset list | findstr /i /c:"c:">nul
>         if not {%errorlevel%}=={0} set NoPagingFileC=true&goto :FindCurrentPagingFileSettingsP
>     for /f "tokens=1-10 delims= " %%a in ('wmic pagefileset list ^| findstr /i /c:"c:"') do (
>         set CurrentInitialPagingFileSizeMBC=%%d
>         set CurrentMaximumPagingFileSizeMBC=%%e
>         set CurrentPagingFileC=%%f
>         )
>         if defined CurrentPagingFileC (
>             for /f "tokens=1-10 delims=\" %%a in ('echo %CurrentPagingFileC%') do set CurrentPagingFileCwmic=%%a\\%%b
>             )
>
> I would like to know whether its good to write such code as
>
> batch "FindCurrentPagingFileSettingsC" do
> code <<-EOH
> ##  here come the code
> EOH
> end
>
>  or first try to learn some ruby stuff and then write code in ruby. I am new to ruby .
>
> Any help would be great.
>
>
> Thanks & Regards,
> Sachin Gupta
>




Archive powered by MHonArc 2.6.16.

§