[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 580: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 636: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3257)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3257)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3257)
SELinux Super Administrator Forum • CountMsgsByDay script
Page 1 of 1

CountMsgsByDay script

Posted: Mon May 22, 2017 12:05 pm
by Mick Lang
#!/bin/sh -f

##########################################################################
# CountMsgsByDay Script-- this will count all incoming messages for a given time period
##########################################################################

echo "This script will calculate the total number of incoming"
echo "messages for input comms. Please enter the year you would like:"
echo "Year (example: 2016):"; read YEAR
echo " "
echo "Now enter the month:"
echo "MONTH (example: 02 for February):"; read MONTH
echo " "
echo "Now enter the day:"
echo "DAY (example: 02 for the second):"; read DAY

MSGDIR="/var/opt/j**x/msgs"
COMMLISTIN="CommsA/in CommsB/in CommsC/in CommsD/in"

For COMMO in $COMMLISTIN
do
NumMsg="0"
for MONTH in $MONTH
do
if [ -d ${MSGDIR}/{COMMO}/${YEAR}/${DAY} ]
then

NumMsg=`ls -R ${MSGDIR}/{COMMO}/${YEAR}/${MONTH}/${DAY} | wc -l`

fi
done
echo $COMMO : ${YEAR}/${MONTH}/${DAY} : $NumMsg messages[/list]
done