limits: Add show and stats

This commit is contained in:
tschettervictor
2025-03-22 18:44:21 -06:00
committed by GitHub
parent 5280daec7c
commit 9d235fa1a4

View File

@@ -35,7 +35,7 @@
. /usr/local/etc/bastille/bastille.conf
usage() {
error_notify "Usage: bastille limits [option(s)] TARGET [OPTION VALUE|clear|reset]"
error_notify "Usage: bastille limits [option(s)] TARGET [OPTION VALUE|clear|reset|show|stats]"
echo -e "Example: bastille limits TARGET memoryuse 1G"
cat << EOF
Options:
@@ -114,6 +114,18 @@ for _jail in ${JAILS}; do
info "[${TARGET}]: RCTL limits cleared."
fi
;;
show)
# Show limits
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then
rctl jail:${_jail} 2>/dev/null
fi
;;
stats)
# Show statistics
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then
rctl -hu jail:${_jail} 2>/dev/null
fi
;;
reset)
# Remove limits and delete rctl.conf
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then