Like a hundred other people i'm having issues with the PostMaster account being checked at a regular interval to pull down new tickets. I've read just about every post on the forums that i could find related to this. Unfortunately they are all mostly geared toward the Linux based installs. I'm familiar with Putty but I don't think this is gonna do me much good this time. I know that the issue is with Cron but i what I can't figure out is how to fix it.
here is the contents of my crontab.txt file
MAILTO="root@localhost"
20 0 * * 0 C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.DeleteCache.pl --expired
30 0 * * 0 C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.LoaderCache.pl -o delete
*/10 * * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.GenericAgent.pl -c db
*/20 * * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.GenericAgent.pl
45 */2 * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.PendingJobs.pl
*/1 * * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.PostMasterMailbox.pl
01 01 * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.RebuildTicketIndex.pl
55 */2 * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.DeleteSessionIDs.pl --expired
35 * * * * C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.UnlockTickets.pl --time
My goal here is to have OTRS check the exchange server every minute. From what i can tell in my limited understanding of OTRS on windows this should be the place to check to see what cronjobs are enabled..
Here is the contents of my otrs.PostmasterMailbos
Code: Select all
# use ../ as lib location
use File::Basename;
use FindBin qw($RealBin);
use lib dirname($RealBin);
use vars qw($VERSION);
$VERSION = qw($Revision: 1.3 $) [1];
use Getopt::Std;
use Kernel::Config;
use Kernel::System::Encode;
use Kernel::System::Log;
use Kernel::System::Main;
use Kernel::System::Time;
use Kernel::System::DB;
use Kernel::System::PID;
use Kernel::System::PostMaster;
use Kernel::System::MailAccount;
# get options
my %Opts = ();
getopt( 'upshdftb', \%Opts );
if ( $Opts{h} ) {
print "PostMasterMailbox.pl <Revision $VERSION> - Fetch mail accounts for OTRS\n";
print "Copyright (C) 2001-2010 xxx, http://otrs.org/\n";
print "usage: PostMasterMailbox.pl -t <TYPE> (POP3|POP3S|IMAP|IMAPS) -s <server> -u <user> ";
print "-p <password> [-d 1-2] [-b <BACKGROUND_INTERVAL_IN_MIN>] [-f force]\n";
exit 1;
}
# set debug
if ( !$Opts{d} ) {
$Opts{d} = 0;
}
# check -b option
if ( $Opts{b} && $Opts{b} !~ /^\d+$/ ) {
print STDERR "ERROR: Need -b <BACKGROUND_INTERVAL_IN_MIN>, e. g. -b 5 for fetching emails ";
print STDERR "every 5 minutes.\n";
exit 1;
}
# create common objects
my %CommonObject = ();
$CommonObject{ConfigObject} = Kernel::Config->new();
$CommonObject{EncodeObject} = Kernel::System::Encode->new(%CommonObject);
$CommonObject{LogObject} = Kernel::System::Log->new(
LogPrefix => 'OTRS-PostMasterMailbox.pl',
%CommonObject,
);
$CommonObject{MainObject} = Kernel::System::Main->new(%CommonObject);
$CommonObject{TimeObject} = Kernel::System::Time->new(%CommonObject);
$CommonObject{DBObject} = Kernel::System::DB->new(%CommonObject);
$CommonObject{PIDObject} = Kernel::System::PID->new(%CommonObject);
# create pid lock
if ( !$Opts{f} && !$CommonObject{PIDObject}->PIDCreate( Name => 'PostMasterMailbox' ) ) {
print "NOTICE: PostMasterMailbox.pl is already running (use '-f 1' if you want to start it ";
print "forced)!\n";
exit 1;
}
elsif ( $Opts{f} && !$CommonObject{PIDObject}->PIDCreate( Name => 'PostMasterMailbox' ) ) {
print "NOTICE: PostMasterMailbox.pl is already running but is starting again!\n";
}
# fetch mails -b is not used
if ( !$Opts{b} ) {
Fetch(%CommonObject);
}
# while to run several times if -b is used
else {
while (1) {
# set new PID
$CommonObject{PIDObject}->PIDCreate(
Name => 'PostMasterMailbox',
Force => 1,
);
# fetch mails
Fetch(%CommonObject);
# sleep till next interval
print "NOTICE: Waiting for next interval ($Opts{b} min)...\n";
sleep 60 * $Opts{b};
}
}
# delete pid lock
$CommonObject{PIDObject}->PIDDelete( Name => 'PostMasterMailbox' );
exit(0);
sub Fetch {
my (%CommonObject) = @_;
my $MailAccount = Kernel::System::MailAccount->new(%CommonObject);
# debug info
if ( $Opts{d} > 1 ) {
$CommonObject{LogObject}->Log(
Priority => 'debug',
Message => 'Global OTRS email handle (PostMasterMailbox.pl) started...',
);
}
if ( $Opts{s} || $Opts{u} || $Opts{p} || $Opts{t} ) {
if ( !$Opts{t} ) {
# delete pid lock
$CommonObject{PIDObject}->PIDDelete( Name => 'PostMasterMailbox' );
print STDERR "ERROR: Need -t <TYPE> (POP3|IMAP)\n";
exit 1;
}
if ( !$Opts{s} ) {
# delete pid lock
$CommonObject{PIDObject}->PIDDelete( Name => 'PostMasterMailbox' );
print STDERR "ERROR: Need -s <SERVER>\n";
exit 1;
}
if ( !$Opts{u} ) {
# delete pid lock
$CommonObject{PIDObject}->PIDDelete( Name => 'PostMasterMailbox' );
print STDERR "ERROR: Need -u <USER>\n";
exit 1;
}
if ( !$Opts{p} ) {
# delete pid lock
$CommonObject{PIDObject}->PIDDelete( Name => 'PostMasterMailbox' );
print STDERR "ERROR: Need -p <PASSWORD>\n";
exit 1;
}
$MailAccount->MailAccountFetch(
Login => $Opts{u},
Password => $Opts{p},
Host => $Opts{s},
Type => $Opts{t},
Trusted => 0,
DispatchingBy => '',
QueueID => 0,
Debug => $Opts{d},
CMD => 1,
UserID => 1,
);
}
else {
my %List = $MailAccount->MailAccountList( Valid => 1 );
for my $Key ( keys %List ) {
my %Data = $MailAccount->MailAccountGet( ID => $Key );
$MailAccount->MailAccountFetch(
%Data,
Debug => $Opts{d},
CMD => 1,
UserID => 1,
);
}
}
# debug info
if ( $Opts{d} > 1 ) {
$CommonObject{LogObject}->Log(
Priority => 'debug',
Message => 'Global OTRS email handle (PostMasterMailbox.pl) stopped.',
);
}
}