[otrs-cvs] otrs/bin otrs.Cron4Win32.pl,1.12,1.13
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/bin
In directory lancelot:/tmp/cvs-serv14694/bin
Modified Files:
otrs.Cron4Win32.pl
Log Message:
All Perl dependencies now test and build without issues. Dependencies are provided by Task::OTRS::Win32.
Author: mb
Index: otrs.Cron4Win32.pl
===================================================================
RCS file: /home/cvs/otrs/bin/otrs.Cron4Win32.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -2 -u -d -r1.12 -r1.13
--- otrs.Cron4Win32.pl 20 Nov 2012 16:03:21 -0000 1.12
+++ otrs.Cron4Win32.pl 21 Jan 2013 16:54:46 -0000 1.13
@@ -1,6 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
# --
# bin/otrs.Cron4Win32.pl - a script to generate a full crontab file for OTRS
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -25,4 +25,6 @@
use warnings;
+use Path::Class;
+
use File::Basename;
use FindBin qw($RealBin);
@@ -34,10 +36,24 @@
$VERSION = qw($Revision$) [1];
-my $PerlExe = "";
-my $Directory = "";
+# $CronTabFile is replaced by the Windows Installer if it is empty
my $CronTabFile = "";
-my $OTRSHome = "";
-opendir( my $DirHandle, $Directory ) or die "ERROR: Can't open $Directory: $!";
+my $OTRSHome = dirname($RealBin);
+my $CronDir = dir( $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 ) or die "ERROR: Can't open $CronDir: $!";
my @Entries = readdir($DirHandle);
@@ -45,10 +61,11 @@
open my $CronTab, '>', $CronTabFile
or die "ERROR: Can't write to file $CronTabFile: $!";
+print "Writing to $CronTabFile...\n\n";
CRONFILE:
for my $CronData (@Entries) {
- next CRONFILE if ( !-f "$Directory/$CronData" );
+ next CRONFILE if ( !-f "$CronDir/$CronData" );
next CRONFILE if ( $CronData eq 'postmaster.dist' );
- open( my $Data, '<', "$Directory/$CronData" )
- or die "ERROR: Can't open file $Directory/$CronData: $!";
+ open( my $Data, '<', "$CronDir/$CronData" )
+ or die "ERROR: Can't open file $CronDir/$CronData: $!";
LINE:
while ( my $Line = <$Data> ) {
@@ -57,5 +74,5 @@
# replace $HOME with path to Perl plus path to script
- $Line =~ s{\$HOME}{$PerlExe $OTRSHome}xms;
+ $Line =~ s{\$HOME}{$^X $OTRSHome}xms;
# there's no /dev/null on Win32, remove it:
@@ -67,3 +84,5 @@
close($CronTab);
+print "Done.\n";
+
1;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log