-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the regex for soft and hard memlock
- get only the last entry in the event of duplicates. - recognize 'infinity' and '-1' in addition to 'unlimited' as per limits.conf man page
- Loading branch information
Showing
3 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
oracle soft nproc 2047 | ||
oracle hard nproc 16384 | ||
oracle soft nofile 1024 | ||
oracle hard nofile 65536 | ||
|
||
oracle soft memlock 2048 | ||
oracle soft memlock 1024 | ||
#oracle soft memlock -1 | ||
#oracle soft memlock infinity | ||
#oracle soft memlock unlimited | ||
oracle soft memlock bogus | ||
|
||
oracle hard memlock 2048 | ||
oracle hard memlock 1024 | ||
#oracle hard memlock -1 | ||
#oracle hard memlock infinity | ||
oracle hard memlock unlimited | ||
oracle hard memlock bogus | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/bash | ||
|
||
# test regex for pulling memlock from /etc/security/limits.conf | ||
|
||
# duplicate entries may appear in the file | ||
# the following are duplicates for 'oracle soft memlock' | ||
# the second one of 1078768 will be the one used by the system | ||
# | ||
# oracle soft memlock 5078768 | ||
# oracle soft memlock 1078768 | ||
|
||
# Test Variables | ||
TOTALMEM=33554432 | ||
(( TOTALMEM_BYTES = TOTALMEM * 1024 )) | ||
LIMITS_FILE=limits-test.conf | ||
####################################### | ||
|
||
# from the limits.conf man page | ||
# All items support the values -1, unlimited or infinity indicating no limit, except for priority and nice. | ||
|
||
SOFT_MEMLOCK=$( grep -E '^oracle.*soft.*memlock.*(unlimited|infinity|-1)|^oracle.*soft.*memlock.*[0-9]++' $LIMITS_FILE | tail -1 | awk '{ print $4 }') | ||
if [[ -z $SOFT_MEMLOCK ]]; then | ||
SOFT_MEMLOCK=$( grep -E '^\*.*soft.*memlock.*(unlimited|infinity|-1)|^\*.*soft.*memlock.*[0-9]+' $LIMITS_FILE | tail -1 | awk '{ print $4 }') | ||
fi | ||
[[ $(echo $SOFT_MEMLOCK | grep -E 'unlimited|infinity|-1') ]] && SOFT_MEMLOCK=$TOTALMEM | ||
|
||
HARD_MEMLOCK=$( grep -E '^oracle.*hard.*memlock.*(unlimited|infinity|-1)|^oracle.*hard.*memlock.*[0-9]+' $LIMITS_FILE | tail -1 | awk '{ print $4 }') | ||
if [[ -z $HARD_MEMLOCK ]]; then | ||
HARD_MEMLOCK=$( grep -E '^\*.*hard.*memlock.*(unlimited|infinity|-1)|^\*.*hard.*memlock.*[0-9]+' $LIMITS_FILE | tail -1 | awk '{ print $4 }') | ||
fi | ||
[[ $(echo $HARD_MEMLOCK | grep -E '(unlimited|infinity|-1)|infinity|-1') ]] && HARD_MEMLOCK=$TOTALMEM | ||
|
||
[[ -z $SOFT_MEMLOCK ]] && SOFT_MEMLOCK=0 | ||
[[ -z $HARD_MEMLOCK ]] && HARD_MEMLOCK=0 | ||
|
||
(( SOFT_MEMLOCK_BYTES = SOFT_MEMLOCK * 1024 )) | ||
(( HARD_MEMLOCK_BYTES = HARD_MEMLOCK * 1024 )) | ||
|
||
|
||
cat <<MEMINFO | ||
OS: | ||
totalmem: $TOTALMEM | ||
in bytes: $TOTALMEM_BYTES | ||
soft_memlock: $SOFT_MEMLOCK | ||
in bytes: $SOFT_MEMLOCK_BYTES | ||
hard_memlock: $HARD_MEMLOCK | ||
in bytes: $HARD_MEMLOCK_BYTES | ||
MEMINFO | ||
|
||
|