/usr/share/otrs/bin/otrs.Cron4Win32.pl is in otrs2 3.3.5-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | #!/usr/bin/perl
# --
# bin/otrs.Cron4Win32.pl - a script to generate a full crontab file for OTRS
# Copyright (C) 2001-2014 OTRS AG, http://otrs.com/
# --
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU AFFERO General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# or see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use File::Basename;
use File::Spec;
use FindBin qw($RealBin);
use lib dirname($RealBin);
use lib dirname($RealBin) . '/Kernel/cpan-lib';
use lib dirname($RealBin) . '/Custom';
# $CronTabFile is replaced by the Windows Installer if it is empty
my $CronTabFile = "";
my $OTRSHome = dirname($RealBin);
my $CronDir = File::Spec->catfile( $OTRSHome, 'var/cron' );
# if $CronTabFile is not set by windows installer, for instance
# with a manual installation, require an argument for the location
if ( !$CronTabFile ) {
if ( !$ARGV[0] ) {
print "Usage: $0 [outputfile]\n\n";
print "Example: $0 C:\\CronW\\crontab.txt\n";
exit 1;
}
else {
$CronTabFile = $ARGV[0];
}
}
opendir( my $DirHandle, $CronDir ) || die "ERROR: Can't open $CronDir: $!";
my @Entries = readdir($DirHandle);
closedir($DirHandle);
## no critic
open my $CronTab, '>', $CronTabFile
|| die "ERROR: Can't write to file $CronTabFile: $!";
## use critic
print "Writing to $CronTabFile...\n\n";
CRONFILE:
for my $CronData (@Entries) {
next CRONFILE if ( !-f "$CronDir/$CronData" );
next CRONFILE if ( $CronData eq 'postmaster.dist' );
## no critic
open( my $Data, '<', "$CronDir/$CronData" )
|| die "ERROR: Can't open file $CronDir/$CronData: $!";
## use critic
LINE:
while ( my $Line = <$Data> ) {
next LINE if ( $Line =~ m{ \A \# }xms );
next LINE if ( $Line eq "\n" );
# replace $HOME with path to Perl plus path to script
$Line =~ s{\$HOME}{$^X $OTRSHome}xms;
# there's no /dev/null on Win32, remove it:
$Line =~ s{>>\s*/dev/null}{}xms;
print $CronTab "$Line";
}
close($Data);
}
close($CronTab);
print "Done.\n";
1;
|