OTRS on windows won't check email at regular interval

Moderator: crythias

Post Reply
packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

OTRS 3.0.11 on windows

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 OTRS AG, 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.',
        );
    }
}
Does anyone know if this file needs to be modified in any way? The documentation is pretty limited in respect to this particular issue. Any help would be GREATLY appreciated.
Last edited by crythias on 16 Nov 2013, 18:33, edited 1 time in total.
Reason: code tags

ugob
OTRS newbie
Posts: 40
Joined: 29 Jul 2011, 22:15
OTRS Version?: 3.0

Re: OTRS on windows won't check email at regular interval

Post by ugob »

What software do you use to run cronjobs on Windows?

packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

Re: OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

EXACTLY!

There isn't much in the way of documentation for windows installs of OTRS... i tried running a script in task scheduler but that was no joy since you can't really do it every x number of minutes. I'm at my wits end trying to get OTRS to check the email at a regular interval...

jojo
Moderator
Posts: 14665
Joined: 26 Jan 2007, 14:50
OTRS Version?: Git Master
Contact:

Re: OTRS on windows won't check email at regular interval

Post by jojo »

OTRS Installer includes CronW. Is this service running?
"Production": OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com :: Share your ideas

packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

Re: OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

The cron service is running... i've restarted it a dozen times... doesn't make a difference..

Wolfgangf
OTRS guru
Posts: 1026
Joined: 13 Apr 2009, 12:26
OTRS Version?: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: OTRS on windows won't check email at regular interval

Post by Wolfgangf »

and you renamed the .dist files in order to active the specific section?
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting

packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

Re: OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

no i haven't renamed anything.. which files need to be renamed?

Wolfgangf
OTRS guru
Posts: 1026
Joined: 13 Apr 2009, 12:26
OTRS Version?: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: OTRS on windows won't check email at regular interval

Post by Wolfgangf »

can you check if there are *.dist files in the directory <OTRS_HOME>/var/cron/ ?
if yes remove the .dist extension and restart your Cron
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting

ferrosti
OTRS ninja
Posts: 723
Joined: 10 Oct 2007, 14:30
OTRS Version?: 3.0
Location: Hamburg, Germany

Re: OTRS on windows won't check email at regular interval

Post by ferrosti »

What does your log say? Is there some entry, that says PostMaster is already running?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems

packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

Re: OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

All of the files in var/cron say they are of the DIST type but the actual filenames don't end in DIST

For example I have;
aa_base
cache
fetchmail
generic_agent
etc...

none of the filenames end in .DIST


here is the contents of CronW/logs/cronw i have obviously restarted the service several times to see if anything i've tried so far would work... looks to me like it's been running since yesterday 2/1 without any additional info or errors




[2012/01/16 14:30:03] starting service
[2012/01/16 14:30:03] cron dir 'C:\Program Files\OTRS\CRONw\cron.daily' does not exist.
[2012/01/16 14:30:03] Created cron dir 'C:\Program Files\OTRS\CRONw\cron.daily' successfuly.
[2012/01/16 14:30:03] cron dir 'C:\Program Files\OTRS\CRONw\cron.weekly' does not exist.
[2012/01/16 14:30:03] Created cron dir 'C:\Program Files\OTRS\CRONw\cron.weekly' successfuly.
[2012/01/16 14:30:03] cron dir 'C:\Program Files\OTRS\CRONw\cron.monthly' does not exist.
[2012/01/16 14:30:03] Created cron dir 'C:\Program Files\OTRS\CRONw\cron.monthly' successfuly.
[2012/01/16 14:30:03] cron service started
[2012/01/16 17:40:54] starting service
[2012/01/16 17:40:55] cron service started
[2012/01/17 08:40:31] starting service
[2012/01/17 08:40:32] cron service started
[2012/01/17 12:22:05] starting service
[2012/01/17 12:22:06] cron service started
[2012/01/17 12:23:59] starting service
[2012/01/17 12:24:00] cron service started
[2012/01/20 09:52:59] starting service
[2012/01/20 09:53:00] cron service started
[2012/01/25 15:51:22] starting service
[2012/01/25 15:51:21] cron service stopped
[2012/01/25 15:51:22] service stopped
[2012/01/25 15:51:22] cron service started
[2012/01/25 16:00:53] starting service
[2012/01/25 16:00:54] cron service started
[2012/01/25 17:22:20] cron service stopped
[2012/01/25 17:22:20] service stopped
[2012/01/25 17:22:20] starting service
[2012/01/25 17:22:21] cron service started
[2012/01/25 17:26:40] cron service stopped
[2012/01/25 17:26:40] service stopped
[2012/01/25 17:26:41] starting service
[2012/01/25 17:26:41] cron service started
[2012/01/25 17:38:59] starting service
[2012/01/25 17:39:01] cron service started
[2012/01/26 11:23:20] cron service stopped
[2012/01/26 11:23:20] service stopped
[2012/01/26 11:23:20] starting service
[2012/01/26 11:23:21] cron service started
[2012/01/26 11:28:20] cron service stopped
[2012/01/26 11:28:20] service stopped
[2012/01/26 11:28:20] starting service
[2012/01/26 11:28:20] cron service started
[2012/01/26 11:53:00] cron service stopped
[2012/01/26 11:53:00] service stopped
[2012/01/26 11:53:01] starting service
[2012/01/26 11:53:01] cron service started
[2012/02/01 10:21:01] starting service
[2012/02/01 10:21:02] cron service started
[2012/02/01 13:39:20] cron service stopped
[2012/02/01 13:39:20] service stopped
[2012/02/01 13:39:21] starting service
[2012/02/01 13:39:21] cron service started
[2012/02/01 15:13:56] starting service
[2012/02/01 15:13:58] cron service started

ferrosti
OTRS ninja
Posts: 723
Joined: 10 Oct 2007, 14:30
OTRS Version?: 3.0
Location: Hamburg, Germany

Re: OTRS on windows won't check email at regular interval

Post by ferrosti »

All of the files in var/cron say they are of the DIST type but the actual filenames don't end in DIST
Are you sure your explorer shows file extensions? ATM I assume that you have configured your file explorer (as standard) to not show file extensions.

Do you have a file named crontab.txt in your \OTRS\CRONw\ folder? Are the cronjobs entered in there?
Are you running this server in a virtual environment and does its time service work perfectly?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems

packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

Re: OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

Sorry total noob mistake... i changed the file name in var/cron to remove the .dist extension and restarted cron service... still no joy..

Here is the contents of crontab.txt


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 --timeout

this is running in a vmplayer clock looks good to me but i am a noob afterall =)

ferrosti
OTRS ninja
Posts: 723
Joined: 10 Oct 2007, 14:30
OTRS Version?: 3.0
Location: Hamburg, Germany

Re: OTRS on windows won't check email at regular interval

Post by ferrosti »

Please change the MAILTO parm to a valid address.

For some reason this file does either not seem to be executed or the given program paths are invalid.
Please enter some command that really works (like a mkdir or whatever) into the cron file. In case you still get no result you need to make sure that your CronW requirements are all OK. I have no experience setting this up in Windows. The manual should give some good starting point. AFAIK the .DIST files are only needed on Linux machines, while CronW and the .txt file are for Windows.
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems

packetsmasher5000
OTRS newbie
Posts: 7
Joined: 27 Jan 2012, 23:57
OTRS Version?: 3.011
Real Name: Steve Graunke
Company: Target Distributing

Re: OTRS on windows won't check email at regular interval

Post by packetsmasher5000 »

I think i'm almost there....

I ran C:\Program Files\StrawberrPerl\perl\bin\perl.exe "C:\Program Files\OTRS\otrs\bin\Cron4Win32.pl" from a cmd prompt and now i'm finally getting something in the cronlog

error in wday value 'C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe' (8)
[2012/02/15 10:29:00] crontab syntax NOT OK, 1 errors detected
[2012/02/15 10:29:00] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:30:01] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:31:01] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:32:00] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:33:01] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:34:01] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:35:01] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:36:01] failed to start 'C:\Windows\system32\cmd.exe': The directory name is invalid.

[2012/02/15 10:36:40] cron service stopped


so i've got some jacked up syntax somewhere

Any ideas?

eddie
OTRS newbie
Posts: 2
Joined: 03 Apr 2012, 13:37
OTRS Version?: OTRS 3.2.1
Real Name: Eddie Urenda
Company: Hexaware Technologies

Re: OTRS on windows won't check email at regular interval

Post by eddie »

While researching a similar issue on our Windows 3.2.1 installation of OTRS I came across resolution by fixing an errant path in my crontab.txt.

First let me clear up some confusing points for Windows OTRS server users since the majority of folks (myself included when last using) run/ran OTRS on *nix servers while a smaller proportion run on Windows which does work, though it seems to carry over some documentation that has evolved from the *nix installations and sometimes may provide some unclear or apparently quirky behavior (I am happy to chip in on the documentation side if needed like we did in the early days of OTRS) which is nothing but some of the nuances of running this product on Windows:
  • Cronw is not provided with usable crontab scripts on Windows and the scripts contained in \%OTRSHOME%\OTRS\var\cron\ (whether *.dist or without the suffix) are largely unusable as-is, but provide you with the settings that you will need to populate your own crontab.txt in \%OTRSHOME%\OTRS\CRONw\
  • The paths in the sample crontab *.dist files, references to null devices, and variable $HOME are typically not usable in Windows, and this is the most error prone piece of converting these useful files by hand into something valid for Windows Cronw
The above being said, here is how I fixed my problem with enabling my trusty otrs.PostMasterMailbox.pl to fetch mail reliably whenever my crontab.txt darn well tells it to do so:
  1. from a CMD Window stop cron by issuing net cron stop
  2. Temporarily enable DEBUG loggin for cronw to see what is going on (we will turn this off when troubleshooting is over). Previously this file contained a bunch of useful timestampped cron service started/stopped entries with no details on what I was doing wrong -- do this by making sure the following is in your log.conff inside the \%OTRSHOME%s\OTRS\CRONw\ directory:

    log4perl.logger.cronw.cronService-pl = DEBUG, log
    log4perl.logger.cronw.Crontab-pm = DEBUG, log
  3. Start with the misbehaving [i]otrs.PostMasterMailbox.pl[/i] and make sure that you can execute the full path of the command you are trying to insert into crontab.txt from a CMD window (this was the most error-prone part for me), the following command I tested is what worked for me (remember this is using the default directories of OTRS):

    c:\PROGRA~1\OTRS\StrawberryPerl\perl\bin\perl.exe c:\PROGRA~1\OTRS\OTRS\bin\otrs.PostMasterMailbox.pl
  4. Once you iron out the command in the CMD window, place it in your crontab.txt (the following sample runs every 5 minutes) -- remember we will have cronw service off at this point:

    */5 * * * * c:\PROGRA~1\OTRS\StrawberryPerl\perl\bin\perl.exe c:\PROGRA~1\OTRS\OTRS\bin\otrs.PostMasterMailbox.pl
  5. Start up the cron service by issuing net cron start
  6. Examine the log file which is now yielding useful information and will scold you about any syntax/path/other errors it encounters, this is the cronw.log file inside C:\Program Files\OTRS\CRONw\logs
  7. Leave it running for a few minutes and see cronw's attempts to wake up, run your crontab (with the patch information in the log) and then exit successfully and continue waiting for it's next run
  8. Did it not work? You now have the tools and verbosity enabled to see where it is failing and take corrective action -- now you will have to cycle through steps 1-6 until you get positive output from 15-20 minutes of execution time (who said our jobs and troubleshooting is not fun!)
What all done? Don't forget to stop the service as in step 1 and turn the logging in log.conf back to INFO and/or WARN levels that you changed in step 2

eddie
OTRS newbie
Posts: 2
Joined: 03 Apr 2012, 13:37
OTRS Version?: OTRS 3.2.1
Real Name: Eddie Urenda
Company: Hexaware Technologies

Re: OTRS on windows won't check email at regular interval

Post by eddie »

Apologies for replying to my own post, but there is a simply way to start with a working crontab.txt on Windows and it is by using otrs.Cron4Win32.pl which is located in \%OTRSHOME%\OTRS\OTRS\bin

If you backup your broken crontab.txt (in case you want to find out your mistake), you can then proceed to run:

perl otrs.Cront4Win32.pl

which will create a brand new crontab.txt based on the files in \%OTRSHOME%\OTRS\OTRS\var\cron\

I did not see this documented but further research and testing yielded a working crontab.txt, apologies for roundabout way of arriving at something that had a simple answer!

crythias
Moderator
Posts: 10112
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS on windows won't check email at regular interval

Post by crythias »

failed to start 'C:\Windows\system32\cmd.exe':

ok... so is cmd.exe NOT in C:\windows\system32?
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask

brunosprotte
OTRS newbie
Posts: 12
Joined: 17 Sep 2013, 16:05
OTRS Version?: 3.2.10
Real Name: Bruno

Re: OTRS on windows won't check email at regular interval

Post by brunosprotte »

Hi everyone, i've done everything is wrotten but i'm still getting "failed to start 'C:\Windows\system32\cmd.exe':", the cmd.exe is in C:\Windows\System32, any ideas ?

crythias
Moderator
Posts: 10112
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS on windows won't check email at regular interval

Post by crythias »

Code: Select all

C:/PROGRA~1/OTRS/StrawberryPerl/perl/bin/perl.exe C:/PROGRA~1/OTRS/OTRS/bin/otrs.PostMasterMailbox.pl
This is a best-guess of the existing path to perl.exe and may not be reflective of your path to perl.exe, especially if you're using ActiveState Perl or Progra~1 resolves to, for example ProgramData or something else.
Best to use quotes "" and full paths to perl.exe and otrs.PostMasterMailbox.pl

Hint: If it will work if you type it in your command prompt, it will work in crontab. You may have to rebuild cron (otrs/bin/otrs.Cron4Win32.pl ?) if you make changes with otrs/var/cron
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask

brunosprotte
OTRS newbie
Posts: 12
Joined: 17 Sep 2013, 16:05
OTRS Version?: 3.2.10
Real Name: Bruno

Re: OTRS on windows won't check email at regular interval

Post by brunosprotte »

MAILTO="root@localhost"
20 0 * * 0 C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.DeleteCache.pl --expired
30 0 * * 0 C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.LoaderCache.pl -o delete
*/5 * * * * [ -x /usr/bin/fetchmail ] && /usr/bin/fetchmail -a
*/5 * * * * /usr/bin/fetchmail -a --ssl
*/20 * * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.GenericAgent.pl
*/10 * * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.GenericAgent.pl -c db
45 */2 * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.PendingJobs.pl
10 0 * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.cleanup
*/10 * * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.PostMasterMailbox.pl
01 01 * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.RebuildTicketIndex.pl
55 */2 * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.DeleteSessionIDs.pl --expired
35 * * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.UnlockTickets.pl --timeout

OK, this, right ?!
I think that ther cmd.exe error is about this line : " [ -x /usr/bin/fetchmail ] && /usr/bin/fetchmail -a ", but i did not understand what is it ? what should have between [ ] ?

sorry about my english :)

brunosprotte
OTRS newbie
Posts: 12
Joined: 17 Sep 2013, 16:05
OTRS Version?: 3.2.10
Real Name: Bruno

Re: OTRS on windows won't check email at regular interval

Post by brunosprotte »

another detail: When i remove the fetchmail line, the error stops, but i still don't get new tickets from the email configured in adm painel on the OTRS.

crythias
Moderator
Posts: 10112
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS on windows won't check email at regular interval

Post by crythias »

brunosprotte wrote:*/5 * * * * [ -x /usr/bin/fetchmail ] && /usr/bin/fetchmail -a
My guess is that you don't have a fetchmail at /usr/bin on windows. (safe to remove)
brunosprotte wrote:*/10 * * * * C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.PostMasterMailbox.pl
This is what grabs email.
brunosprotte wrote: but i still don't get new tickets from the email configured in adm painel on the OTRS.
This says it should happen every 10 minutes, but, like I said, you should test it from command line...
C:\Perl\bin\perl.exe C:/otrs/OTRS/bin/otrs.PostMasterMailbox.pl
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask

brunosprotte
OTRS newbie
Posts: 12
Joined: 17 Sep 2013, 16:05
OTRS Version?: 3.2.10
Real Name: Bruno

Re: OTRS on windows won't check email at regular interval

Post by brunosprotte »

Ok, doing by command line i got the emails, it was some perl modules pending, now i've made a bat and i'm trying to make the windows scheduler grab the emails by the bat file with the command C:\Perl\bin\perl.exe c:/otrs/otrs/bin/otrs.PostMasterMailbox.pl, soon i will post the result

brunosprotte
OTRS newbie
Posts: 12
Joined: 17 Sep 2013, 16:05
OTRS Version?: 3.2.10
Real Name: Bruno

Re: OTRS on windows won't check email at regular interval

Post by brunosprotte »

So, after a lot of work the problem was about fetch mail, running the postMaster by command line i was prompted with some modules pendding and after installing them i've put all the commands on windows scheduler, so i'm not using cron anymore and it is all OK, until this moment :),
thanks very much, Crysthias.

Post Reply