freedomboneeee/tests/check-limits.sh

22 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash
case $1 in
core-dumps)
if sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/security/limits.conf | grep "hard.*core";then
if [ $(sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/security/limits.conf | grep "hard.*core" | awk -F 'core' '{print $2}' | sed 's/\ *//g') -ne 0 ];then
exit 1
fi
else
exit 1
fi
;;
maxlogins)
if sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/security/limits.conf | grep "maxlogins";then
2016-11-29 23:19:46 +01:00
if [ $(sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/security/limits.conf | grep "maxlogins" | awk -F 'maxlogins' '{print $2}' | sed 's/\ *//g') -ne 2 ];then
exit 1
fi
else
exit 1
fi
;;
esac