mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
Delete cron directory
This commit is contained in:
1 parent
dad563fe75
commit
3e6ff06095
1 file changed
-48
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# The logs are in the mailog/ direcory.
|
||||
# You need to execute (add in the crontab) this script and set the $CONF['maillogging'] to 'YES' in the config.inc.php
|
||||
#
|
||||
|
||||
|
||||
#TO DO
|
||||
# - Delete old logs
|
||||
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
#check if maillog directory exists
|
||||
if [ ! -d ../maillog ]
|
||||
then
|
||||
#create direcotry
|
||||
mkdir ../maillog
|
||||
fi
|
||||
|
||||
|
||||
data=`date --date='1 day ago' +%F`
|
||||
|
||||
mysql -u root --skip-column-names --execute="USE postfix; SELECT username,domain FROM domain_admins WHERE active=1 AND domain <> 'ALL';" | while read username domain
|
||||
do
|
||||
|
||||
#check if folder for domain doesn t exists
|
||||
if [ ! -d ../maillog/$domain ]
|
||||
then
|
||||
echo "Directory does not exists for "$domain
|
||||
#create direcotry
|
||||
mkdir ../maillog/$domain
|
||||
fi
|
||||
|
||||
grep @$domain /var/log/mail.log.1 | grep -v "postfix-policyd" | grep -v postgrey > ../maillog/$domain/$data-bulk.log
|
||||
pflogsumm -i --problems_first --detail 5 ../maillog/$domain/$data-bulk.log > ../maillog/$domain/$data-pflogsum.log
|
||||
grep @$domain /var/log/mail.log.1 | grep "Password mismatch" > ../maillog/$domain/$data-failed-auth.log
|
||||
|
||||
gzip ../maillog/$domain/$data-bulk.log
|
||||
gzip ../maillog/$domain/$data-pflogsum.log
|
||||
gzip ../maillog/$domain/$data-failed-auth.log
|
||||
echo $domain
|
||||
|
||||
# rm ../maillog/$domain/$data-bulk.log
|
||||
# rm ../maillog/$domain/$data-pflogsum.log
|
||||
# rm ../maillog/$domain/$data-failed-auth.log
|
||||
done
|
||||
Reference in new issue
Block a user