#!/bin/sh

# Set default values
APPDIR=${APPDIR:-..}
VERBOSE=${VERBOSE:-0}

. ${APPDIR}/common.subr

sect "Misc information";

subsect "Open file statistics (cur/max):"
pstat -T | head -n 1

subsect "\nResource limits:"
limits -a

if check_privs /etc/crontab; then
	subsect "\nInformation related to cron:"
	echo "There are `grep -v "^#" /etc/crontab | grep -c "^[[:digit:]]\|\*"` entries in /etc/crontab"
	echo
fi

if [ -d /var/cron/tabs ] && ls /var/cron/tabs/* >/dev/null 2>&1; then
	subsect "Per user crontabs:"

	for c in $(ls /var/cron/tabs); do
		echo "$c: `grep -v "^#" /var/cron/tabs/$c | grep -c "^[[:digit:]]\|\*"` entries"
	done
	echo
fi

if check_privs /var/cron/allow; then
	echo "These users are allowed to use their own crontab:"
	cat /var/cron/allow
	echo
fi

if check_privs /var/cron/deny; then
	echo "These users are dissallowed to have their own crontab:"
	cat /var/cron/deny
	echo
fi

subsect "Current time and date:"
date

exit 0
