我正在尝试使用puppet安装/设置tomcat7。
我还没有找到一个允许我设置最大堆内存的模块。
所以我一直在尝试将“CATALINA_OPTS = -Xmx2048m”这一行注入catalina.sh文件中。
我不确定最好的方法是做什么。我查看了file_line资源,但我不知道如何在catalina.sh文件的中间插入它。
欢迎任何建议。
更新: 有些人建议模板,但我不需要参数化任何东西。我想能够采取tomcat安装生成的任何catalina.sh并向其中注入一行。如果我使用了模板,或者用修改过的副本替换了文件,那么我安装的下一个tomcat可能会有不同的catalina.sh,这会覆盖新的文件格式。
也许我需要的是在另一条线之后插入一条线的方法。 我相信我可以在#!/ bin / bash行之后插入“CATALINA_OPTS =”。这可能吗?
答案 0 :(得分:3)
使用file_line的matches
参数,因此原始文件中的现有CATALINA_OPTS行将替换为新行。
file_line { "Tomcat Memory":
line => "CATALINA_OPTS=-Xmx2048m",
path=> "/route/to/catalina.sh",
notify =>Service['tomcat'],
match => "CATALINA_OPTS=.*",
}
答案 1 :(得分:3)
我遇到了同样的问题。我正在使用puppetlabs / tomcat安装tomcat,但是没有关于管理内存大小的方法。
但是有一种方法可以管理setenv.sh,它可以让你设置JAVA
这是一个应该做你想做的事的例子:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
<!-- ========================= -->
<!-- root element: m11base -->
<!-- ========================= -->
<xsl:template match="m11base">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions">
<!-- -->
<fo:layout-master-set>
<fo:simple-page-master master-name="first" margin-right="0.8cm" margin-left="0.8cm" margin-bottom="1.0cm" margin-top="1.5cm" page-width="29.7cm" page-height="21cm">
<fo:region-body margin-bottom="0.5cm" margin-top="0cm"/>
<!--<fo:region-before extent="0cm"/>
<fo:region-after extent="0cm"/>-->
</fo:simple-page-master>
<fo:simple-page-master master-name="rest" margin-right="0.8cm" margin-left="0.8cm" margin-bottom="1.0cm" margin-top="1.5cm" page-width="29.7cm" page-height="21cm">
<fo:region-body margin-bottom="0.5cm" margin-top="0cm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first"
master-reference="first"/>
<fo:conditional-page-master-reference page-position="rest"
master-reference="rest"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="document" language="ru" hyphenate="true">
<!--
<fo:static-content flow-name="xsl-region-before">
<fo:block line-height="12pt" font-family="Arial" font-size="10pt" space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always">Trebovanie-nakladnaja</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
-->
<!--
<fo:block line-height="12pt" font-family="Arial" font-size="10pt" space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always">
... the footer should be inserted here ...
</fo:block>
</fo:static-content>
-->
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="100%" margin-bottom="0cm">
<fo:inline white-space-collapse="false"></fo:inline>
</fo:block>
</fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="100%" margin-bottom="0cm" margin-left="21.4cm">
<fo:inline font-family="Arial" font-size="8pt">Типовая межотраслевая форма №</fo:inline></fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="100%" margin-bottom="0cm" margin-left="21.4cm">
<fo:inline font-family="Arial" font-size="8pt">Утверждена постановлением </fo:inline></fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="100%" margin-bottom="0cm" margin-left="21.4cm">
<fo:inline font-family="Arial" font-size="8pt">от 30.10.97</fo:inline>
</fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="5pt" margin-bottom="0cm" margin-left="21.4cm">
</fo:block>
<fo:table text-align="left">
<fo:table-column column-width="2.88cm"/>
<fo:table-column column-width="4.78cm"/>
<fo:table-column column-width="9.24cm"/>
<fo:table-column column-width="3.72cm"/>
<fo:table-column column-width="2.7cm"/>
<fo:table-column column-width="2.83cm"/>
<fo:table-column column-width="1.95cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding="2pt" height="13pt" number-columns-spanned="2">
<fo:block line-height="100%" font-family="Arial" font-size="10pt" keep-together="always">
<fo:inline white-space-collapse="false"></fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt">
<fo:block keep-together="always" font-weight="bold" line-height="100%" font-family="Arial" font-size="16pt" text-align="right" display-align="after">ТРЕБОВАНИЕ-НАКЛАДНАЯ №</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="1pt solid black" padding="2pt">
<fo:block keep-together="always" font-weight="bold" line-height="100%" font-family="Arial" font-size="16pt" text-align="left" display-align="after"><xsl:value-of select="nomnakl"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" number-columns-spanned="2">
<fo:block line-height="100%" font-family="Arial" font-size="10pt" keep-together="always">
<fo:inline white-space-collapse="false"></fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid black" padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always" text-align="center" display-align="after">Коды</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" number-columns-spanned="5">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always" margin-right="0.1cm" text-align="end" display-align="after"></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always" margin-right="0.1cm" text-align="end" display-align="after">Форма по ОКУД</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid black" padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always" text-align="center" display-align="after">0315006</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="10pt" keep-together="always" text-align="center" display-align="after">Организация</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="1pt solid black" padding="2pt" number-columns-spanned="4">
<fo:block line-height="100%" font-family="Arial" font-size="10pt" keep-together="always" text-align="center" display-align="after"><xsl:value-of select="organiz"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always" margin-right="0.1cm" text-align="end" display-align="after">по ОКПО</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid black" padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always" text-align="center" display-align="after">80096573</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" height="5pt">
<fo:block line-height="100%" font-family="Arial" font-size="8pt" keep-together="always"></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table text-align="left">
<fo:table-column column-width="2.92cm"/>
<fo:table-column column-width="2.92cm"/>
<fo:table-column column-width="3.47cm"/>
<fo:table-column column-width="3.47cm"/>
<fo:table-column column-width="3.47cm"/>
<fo:table-column column-width="3.47cm"/>
<fo:table-column column-width="2.22cm"/>
<fo:table-column column-width="3.18cm"/>
<fo:table-column column-width="2.98cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black" number-rows-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Дата составления</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-rows-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Код вида операции</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Отправитель</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Получатель</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Корреспондирующий счет</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-rows-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Учетная единица выпуска продукции (работ, услуг)</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">структурное подразделение</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">вид деятельности</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">структурное подразделение</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">вид деятельности</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid black" padding="2pt">
<fo:block font-family="Arial" font-size="8pt" text-align="center">счет, субсчет</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">код аналитического учета</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="datasost"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="codvo"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="podrotpav"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="viddotpav"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="podrpoluch"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="viddpoluch"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="kssb"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="kscod"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="uchedin"/></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" height="5pt">
<fo:block line-height="11pt" font-family="Arial" font-size="8pt" keep-together="always"></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table text-align="left">
<fo:table-column column-width="2.88cm"/>
<fo:table-column column-width="8.52cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="10pt" keep-together="always" text-align="center">Через кого</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="1pt solid black" padding="2pt">
<fo:block line-height="100%" font-family="Arial" font-size="10pt" keep-together="always" text-align="center"><xsl:value-of select="cherezkog"/></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt">
<fo:block line-height="11pt" font-family="Arial" font-size="8pt" keep-together="always"></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table text-align="left">
<fo:table-column column-width="2.22cm"/>
<fo:table-column column-width="2.99cm"/>
<fo:table-column column-width="5.67cm"/>
<fo:table-column column-width="2.74cm"/>
<fo:table-column column-width="1.45cm"/>
<fo:table-column column-width="1.94cm"/>
<fo:table-column column-width="2.02cm"/>
<fo:table-column column-width="2.02cm"/>
<fo:table-column column-width="2.05cm"/>
<fo:table-column column-width="2.3cm"/>
<fo:table-column column-width="2.7cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Корреспондирующий счет</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Материальные ценности</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Единица измерения</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-columns-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Количество</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-rows-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Цена, руб. коп.</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-rows-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Сумма без учета НДС, руб. коп.</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black" number-rows-spanned="2">
<fo:block font-family="Arial" font-size="8pt" text-align="center">Порядковый номер по складской картотеке</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">счет, субсчет</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">код аналитического учета</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">наименование</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">номенклатурный номер</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">код</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">наиме- нование</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">затребовано</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">отпущено</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">1</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">2</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">3</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">4</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">5</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">6</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">7</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">8</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">9</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">10</fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center">11</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:apply-templates/>
<fo:table-row>
<fo:table-cell padding="2pt">
<fo:block line-height="11pt" font-family="Arial" font-size="8pt" space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always"></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="100%">
<fo:inline white-space-collapse="false"></fo:inline>
<fo:inline white-space-collapse="false"></fo:inline>
</fo:block>
<fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" line-height="100%" margin-bottom="0cm" margin-top="1.2cm">
<fo:inline white-space-collapse="false"></fo:inline>
</fo:block>
</fo:block>
<fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt" keep-together="always" id="LastPage" line-height="1pt" font-family="Arial" font-size="1pt"></fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<!-- ========================= -->
<!-- child element: m11mtrl -->
<!-- ========================= -->
<xsl:template match="m11mtrl">
<fo:table-row>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="ks2sb"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="ks2cod"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="mtrltxt"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="mtrlnom"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="eicod"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="ei"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="kolichzatreb"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="kolichotp"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="cena"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="summa"/></fo:block>
</fo:table-cell>
<fo:table-cell padding="2pt" border="1pt solid black">
<fo:block font-family="Arial" font-size="8pt" text-align="center"><xsl:value-of select="skladcart"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>
答案 2 :(得分:2)
在我们的debian系统中,我使用以下条目作为“Raul Andres”答案的变体。
file_line { "Tomcat Memory":
line => 'JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -XX:+UseConcMarkSweepGC"',
path=> "/etc/default/tomcat8",
notify => Service['tomcat8'],
match => "^JAVA_OPTS=.*",
}
答案 3 :(得分:1)
我会用模板完全控制文件。这很容易做到。首先定义文件:
class your_module_name ($memory='2048m') {
file { '/where/is/catalina.sh':
owner => 'root',
group => 'root',
mode => '0755',
content => template('your_module_name/catalina.sh.erb');
}
}
现在,将当前版本的catalina.sh
复制到modules/your_module_name/templates/catalina.sh.erb
。只需添加以下行:
CATALINA_OPTS=-Xmx<%=memory%>
它应该像魅力一样。
答案 4 :(得分:0)
如果你正在使用puppetlabs / tomcat模块,正确的方法是使用catalina.sh
类。
如果你没有使用puppetlabs / tomcat,正确的方法是使用stdlib::file_line
文件,不是直接编辑file
。由于前者在默认情况下不存在,因此使用CATALINA_OPTS
或内置JAVA_OPTS
资源很容易通过puppet进行管理。
最后,您应该编辑/---------------------------------------------------------
#ifndef SHAPE_H
#define SHAPE_H
const double PI = 3.14159265359;
//Base Class---------------------------------------------
Class Shape {
protected:
//Dimensions
int dimensions;
double area;
double volume;
public:
//Default Constructor
Shape();
//Destructor
~Shape();
//Get Dimension function
double getDimensions();
//virtual function
virtual double getArea();
virtual double getVolume();
};
//Shape Type-----------------------------------------------
class TwoDimensionalShape : public Shape {
protected:
double d1, d2;
public:
double get_d1() { return d1; }
double get_d2() { return d2; }
double set_d1(double x) { d1 = x; }
double set_d2(double x) { d2 = x; }
};
class ThreeDimensionalshape : public Shape {
protected:
double d1, d2, d3;
public:
double get_d1() { return d1; }
double get_d2() { return d2; }
double get_d3() { return d3; }
double set_d1(double x) { d1 = x; }
double set_d2(double x) { d2 = x; }
double set_d3(double x) { d3 = x; }
};
//two dimensionals Shape classes-------------------------
class Circle : public TwoDimensionalShape {
public:
Circle(); //default constructor
Circle( double r); //regular constructor
double getArea(); //get area function
};
class Square : public TwoDimensionalShape {
public:
Square();
Square(double dim);
double getArea();
};
class Triangle : public TwoDimensionalShape {
public:
Triangle();
Triangle(double dim, double dim2);
double getArea();
};
//three dimensional shape classes-------------------------
class Sphere : public ThreeDimensionalshape {
public:
Sphere();
Sphere(double dim);
double getArea();
double getVolume();
};
class Cube : public ThreeDimensionalshape{
public:
Cube();
Cube(double dim);
double getArea();
double getVolume();
};
class Tetrahedron : public ThreeDimensionalshape{
public:
Tetrahedron();
Tetrahedron(double dim);
double getArea();
double getVolume();
};
变量,该变量仅适用于tomcat,而不是//---------------------------------------------------------
#include <stdlib.h>
#include <cmath.h>
#include "shape.h" //header file
using namespace std;
//----------------------------------------------
//Default constructor
Shape::Shape() : dimensions(0), area(0), volume(0) { }
//Regular constructor
Shape::Shape(int d) : {
dimensions = d;
}
//Function getDimensions
double Shape::getDimensions() {
return dimensions;
}
//Two dimensional shapes-----------------------------------
//Default constructor--------------------
Circle::Circle() {
d1 = 1 ;
}
//Regular constructor--------------------
Circle::Circle( double r ) {
d1 = r;
}
//Circle area
double Circle::getArea() {
area = PI * pow( d1, 2 );
return area;
}
//Default constructor--------------------
Square::Square() {
d1 = 1 ;
d2 = 1;
}
//Regular constructor--------------------
Square::Square( double dim ){
d1 = dim;
d2 = dim;
}
//Square area
double Square::getArea(){
area = pow( d1, 2 );
return area;
}
//Default constructor--------------------
Triangle::Triangle(){
d1 = 1;
d2 = 1;
}
//Regular constructor--------------------
Triangle::Triangle(double dim, double dim2){
d1 = dim;
d2 = dim2;
}
//Triangle area
double Triangle::getArea(){
area = (d1 * d2) / 2;
}
//Three dimensional shapes-----------------------------------
//Default constructor---------------------
Sphere::Sphere(){
d1 = 1;
d2 = 1;
d3 = 1;
}
//Regular constructor---------------------
Sphere::Sphere(double dim) : {
d1 = dim;
d2 = dim;
d3 = dim;
}
//Sphere area
double Sphere::getArea(){
area = 4 * PI * pow( d1, 2 );
return area;
}
//Sphere volume
double Sphere::getVolume(){
volume = (4/3) * PI * pow( d1, 3 );
return volume;
}
//Default constructor---------------------
Cube::Cube(){
d1 = 1;
d2 = 1;
d3 = 1;
}
//Regular constructor---------------------
Cube::Cube(double dim){
d1 = dim;
d2 = dim;
d3 = dim;
}
//Cube area
double Cube::getArea(){
area = pow( d1, 2 );
return area;
}
//Cube Volume
double Cube::getVolume(){
volume = pow( d1, 3 );
return volume;
}
//Default constructor---------------------
Tetrahedron::Tetrahedron(){
d1 = 1;
d2 = 1;
d3 = 1;
}
//Regular constructor---------------------
Tetrahedron::Tetrahedron(double dim){
d1 = dim;
d2 = dim;
d3 = dim;
}
//tetrahedron area
double Tetrahedron::getArea(){
area = sqrt(3) * pow( d1, 2);
return area;
}
//tetrahedron volume
double Tetrahedron::getVolume(){
volume = pow(d1, 3) / (6 * sqrt(2));
return volume;
}
,它将应用于可能由您的某个tomcat应用程序生成的任何子程序。可能与tomcat本身没有相同的内存要求。