Skip to content
jalogisch

debian start stop daemon und die limits

Hinweis: Dieser Beitrag ist von 2012. Technische Angaben (Versionen, Befehle, Links) sind wahrscheinlich nicht mehr aktuell.

unter debian wird eigentlich fast alles was via /etc/init.d/ gestartet wird über den start-stop-daemon geregelt. eigentlich ist das ganze ziemlich praktisch und nimmt einem auch ein paar sachen ab. aber leider gibt es eine limitierung oder nennen wir es bug in den ich jetzt wieder erneut gelaufen bin. arbeitet man in einem system, in welchem limits gesetzt sind1 wundert man sich das scheinbar die limits nicht übernommen werden, egal ob das ganze via user, oder gruppe oder programm eingetragen wurde, die limits greifen einfach nicht. abhilfe könnte da geschaffen werden, indem einfach das init.d script modifiziert wird und z.B. ein beherztes ulimit -Hn 65536 unterhalb der shebang zeile eingefügt wird. klappt aber ist nicht schön. weitaus besser ist es zu prüfen nicht vielleicht schon ein passendes file unter /etc/default gibt. in meinem fall gab es für den tomcat6 schon etwas passendes.

TOMCAT6_USER=tomcat6
TOMCAT6_GROUP=tomcat6
JAVA_OPTS="-Djava.awt.headless=true -Xms28G -Xmx28G -XX:+UseConcMarkSweepGC"
unset LC_ALL
ulimit -Hn 65536 
ulimit -Sn 65536

also ist hier unter der /etc/default/tomcat6 der passende ort sowohl für die einstellung des memory limits, als auch für das setzen des ulimits.

warum /etc/default wird in der debian-policy ganz gut erklärt:

Often there are some variables in the init.d scripts whose values control the behavior of the scripts, and which a system administrator is likely to want to change. As the scripts themselves are frequently conffiles, modifying them requires that the administrator merge in their changes each time the package is upgraded and the conffile changes. To ease the burden on the system administrator, such configurable values should not be placed directly in the script. Instead, they should be placed in a file in /etc/default, which typically will have the same base name as the init.d script. This extra file should be sourced by the script when the script runs. It must contain only variable settings and comments in SUSv3 sh format. It may either be a conffile or a configuration file maintained by the package maintainer scripts. See Configuration files, Section 10.7 for more details.