cleanupdirs.pl:

- allow usage of external config file (/etc/mail/postfixadmin/cleanupdirs.conf)
- skip everything that is not a directory (instead of bailing out with an error)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@649 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
Christian Boltz 15 years ago
parent 5ec73b7044
commit 4e69d49089

@ -42,13 +42,21 @@ use File::Path;
use Getopt::Long;
### change settings as needed, see notes above #################################
my $root_path = "/home/vmail";
my $logfile = "/var/log/removed_maildirs.log";
my $db_hostname = "localhost";
my $db_port = "3306";
my $db_database = "postfix";
my $db_username = "someuser";
my $db_password = "somepass";
our $root_path = "/home/vmail";
our $logfile = "/var/log/removed_maildirs.log";
our $db_hostname = "localhost";
our $db_port = "3306"; # this script currently supports MySQL only
our $db_database = "postfix";
our $db_username = "someuser";
our $db_password = "somepass";
# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/cleanupdirs.conf
# just use perl syntax there to fill the variables listed above (without the "our" keyword). Example:
# $db_username = 'mail';
if (-f "/etc/mail/postfixadmin/cleanupdirs.conf") {
require "/etc/mail/postfixadmin/cleanupdirs.conf";
}
################################################################################
### begin program ##############################################################
@ -63,6 +71,7 @@ opendir DOMAINDIR, $root_path
or die "Unable to access directory '$root_path' ($!)";
foreach my $domain_dir (sort readdir DOMAINDIR) {
next if $domain_dir =~ /^\./; # skip dotted dirs
next if (! -d "$root_path/$domain_dir"); # skip everything that is not a directory
my $full_domain_dir = "$root_path/$domain_dir";
opendir USERDIR, $full_domain_dir
or die "Unable to access directory '$full_domain_dir' ($!)";

Loading…
Cancel
Save