60 lines
1.4 KiB
Perl
60 lines
1.4 KiB
Perl
#!/usr/bin/perl -w
|
|
|
|
#----------------------------------------------------------------------
|
|
# Author: stephen noble dungog.net
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#----------------------------------------------------------------------
|
|
|
|
package esmith;
|
|
|
|
use strict;
|
|
use Errno;
|
|
use esmith::config;
|
|
use esmith::util;
|
|
use esmith::db;
|
|
|
|
my %conf;
|
|
tie %conf, 'esmith::config';
|
|
|
|
my %accounts;
|
|
tie %accounts, 'esmith::config', '/home/e-smith/db/accounts';
|
|
|
|
#get list of users
|
|
my @userAccounts = ();
|
|
foreach (keys %accounts)
|
|
{
|
|
push (@userAccounts, $_)
|
|
if (db_get_type(\%accounts, $_) eq "user" || $_ eq "admin");
|
|
}
|
|
|
|
#for each user
|
|
my $userName = '';
|
|
foreach $userName (sort @userAccounts)
|
|
{
|
|
my $path = ($userName eq 'admin')? "/home/e-smith":"/home/e-smith/files/users/$userName";
|
|
|
|
foreach ('procmail','mailfilter')
|
|
{
|
|
if (-f "$path/$_.log.2")
|
|
{
|
|
unlink("$path/$_.log.2");
|
|
}
|
|
|
|
if (-f "$path/$_.log.1")
|
|
{
|
|
system("/bin/mv $path/$_.log.1 $path/$_.log.2");
|
|
}
|
|
|
|
if (-f "$path/$_.log")
|
|
{
|
|
system("/bin/mv $path/$_.log $path/$_.log.1");
|
|
}
|
|
}
|
|
}
|
|
|
|
exit (0);
|