#!/home/product/code/webui-perl/bin/perl -T -I /home/product/code/firmware/current/lib/perl5
#SUDOER_USERS: nobody
#SUDOER_RUNAS_USERS: root, mta
#SUDOER_TAGS: NOPASSWD, EXEC
use strict;
use warnings;
use Barracuda::Sudo::Lib;

###############################################################################

=pod

=head1 NAME

clear_message_log

=head1 DESCRIPTION

Script to remove the existing /mail/mstore and /mail/log/archive
directories and re-instantiate them with proper perms.

=cut

###############################################################################

# Start by moving and recreating the mesage log directory
system(qw(/bin/mv /mail/mstore /mail/mstore.old));
system(qw(/bin/mkdir -m777 /mail/mstore));
system(qw(/bin/chown scana.scana /mail/mstore));

# Finally, move aside and recreate the archive directory
system(qw(/bin/mv /mail/log/archive /mail/log/archive.old));
system(qw(/bin/mkdir -m777 /mail/log/archive));
system(qw(/bin/chown scana.scana /mail/log/archive));
