sapconf/SOURCES/sapconf-check-resource-limit

28 lines
1.4 KiB
Plaintext

diff -up sapconf-0.98/sapconf.resource-limit sapconf-0.98/sapconf
--- sapconf-0.98/sapconf.resource-limit 2017-09-11 14:56:55.457791517 +0200
+++ sapconf-0.98/sapconf 2017-09-11 16:34:34.116857953 +0200
@@ -387,6 +387,7 @@ fi #[ $ec -eq 0 ]
function update_limits_conf() {
local date olds oldval news newval LIMITS
LIMITS=/etc/security/limits.d/99-sap-limits.conf
+ LIMITS_SAP_CONF=/etc/security/limits.d/99-sap.conf
LIMITS_CONF=/etc/security/limits.conf
date=`date -u +"%Y-%m-%d %H:%M:%S %Z"`
newval=($1 $2 $3 $4)
@@ -398,6 +399,15 @@ function update_limits_conf() {
if [ "${oldval[3]}" != "${newval[3]}" ]; then
sed -i "s/$olds/# Changed by sapconf on $date\n#\ &\n$news/" "$LIMITS_CONF"
fi
+ elif [ -e "$LIMITS_SAP_CONF" ] ; then
+ olds=`tac "$LIMITS_SAP_CONF" | grep -E "^[^#]*$1" | grep "$2" | grep -m1 "$3"`
+ if [ $? -eq 0 ] ; then # entry there, update
+ oldval=($olds)
+ if [ "${oldval[3]}" != "${newval[3]}" ]; then
+ sed -i "s/$olds/# Changed by sapconf on $date\n#\ &\n$news/" "$LIMITS_SAP_CONF"
+ fi
+ fi
+
else
if [ -e "$LIMITS" ]; then
olds=`tac "$LIMITS" | grep -E "^[^#]*$1" | grep "$2" | grep -m1 "$3"`