Changeset 16192
- Timestamp:
- 2008-06-25T20:01:23+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/bin/script/schedule.pl
r16137 r16192 58 58 use parse3; 59 59 use gsprintf 'gsprintf'; 60 60 if($ENV{'GSDLOS'} eq "windows") { 61 eval("require \"Win32.pm\" "); 62 } 61 63 62 64 my $frequency_list = … … 217 219 my $hashParsingResult = {}; 218 220 my $intArgLeftAfterParsing; 219 if($gli && $os eq "linux") {221 if($gli && ($os eq "linux" || $os eq "darwin")) { 220 222 $intArgLeftAfterParsing = parse3::parse(\@ARGV, $arguments, $hashParsingResult, "allow_extra_options"); 221 223 } else { … … 276 278 277 279 $newpl = "cron.pl"; 278 my $logfile = "cron".time().".txt";279 280 280 281 if($action eq "delete") { … … 300 301 if ($os =~ /^linux$/ || $os =~ /^darwin$/) { 301 302 302 $import = $import." 2>$gsdl/collect/$colname/log/ $logfile";303 $build = $build." 2>>$gsdl/collect/$colname/log/ $logfile";304 $erase = "\\\\rm -r $gsdl/collect/$colname/index 2>>$gsdl/collect/$colname/log/ $logfile";305 $erase2 = "mkdir $gsdl/collect/$colname/index 2>>$gsdl/collect/$colname/log/ $logfile";306 $copy = "mv $gsdl/collect/$colname/building/* $gsdl/collect/$colname/index/ 2>>$gsdl/collect/$colname/log/ $logfile";303 $import = $import." 2>$gsdl/collect/$colname/log/\$logfile"; 304 $build = $build." 2>>$gsdl/collect/$colname/log/\$logfile"; 305 $erase = "\\\\rm -r $gsdl/collect/$colname/index 2>>$gsdl/collect/$colname/log/\$logfile"; 306 $erase2 = "mkdir $gsdl/collect/$colname/index 2>>$gsdl/collect/$colname/log/\$logfile"; 307 $copy = "mv $gsdl/collect/$colname/building/* $gsdl/collect/$colname/index/ 2>>$gsdl/collect/$colname/log/\$logfile"; 307 308 if($email) { 308 309 #first,we need to add backslashes before the 'at' symbol. … … 310 311 $fromaddr =~ s/\@/\\\@/g; 311 312 312 $ecmd = "$gsdl/bin/script/sendmail.pl -to $toaddr -from $fromaddr -smtp $smtp -msgfile $gsdl/collect/$colname/log/ $logfile -subject \\\"Results of build for collection $colname\\\" 2>>$gsdl/collect/$colname/log/$logfile >>$gsdl/collect/$colname/log/$logfile";313 314 $ecmd2 = "$gsdl/bin/script/sendmail.pl -to $toaddr -from $fromaddr -smtp $smtp -msgfile $gsdl/etc/cronlock.txt -subject \\\"Results of build for collection $colname\\\" 2>>$gsdl/collect/$colname/log/ $logfile >>$gsdl/collect/$colname/log/$logfile";313 $ecmd = "$gsdl/bin/script/sendmail.pl -to $toaddr -from $fromaddr -smtp $smtp -msgfile $gsdl/collect/$colname/log/\$logfile -subject \\\"Results of build for collection $colname\\\" 2>>$gsdl/collect/$colname/log/\$logfile"; 314 315 $ecmd2 = "$gsdl/bin/script/sendmail.pl -to $toaddr -from $fromaddr -smtp $smtp -msgfile $gsdl/etc/cronlock.txt -subject \\\"Results of build for collection $colname\\\" 2>>$gsdl/collect/$colname/log/\$logfile"; 315 316 } 316 317 … … 338 339 $build =~ s/\\collect/\\collect\\\"/; 339 340 340 $import = "$import 2>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" ";341 $build = "$build 2>>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" ";342 343 344 $erase = "rd \\\/S \\\/Q \\\"$gsdl\\\\collect\\\\$colname\\\\index\\\" 2>>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" ";345 $erase2 = "md \\\"$gsdl\\\\collect\\\\$colname\\\\index\\\" 2>>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" ";346 $copy = "xcopy \\\/E \\\/Y \\\"$gsdl\\\\collect\\\\$colname\\\\building\\\\*\\\" \\\"$gsdl\\\\collect\\\\$colname\\\\index\\\\\\\" >>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" ";341 $import = "$import 2>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 342 $build = "$build 2>>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 343 344 345 $erase = "rd \\\/S \\\/Q \\\"$gsdl\\\\collect\\\\$colname\\\\index\\\" 2>>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 346 $erase2 = "md \\\"$gsdl\\\\collect\\\\$colname\\\\index\\\" 2>>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 347 $copy = "xcopy \\\/E \\\/Y \\\"$gsdl\\\\collect\\\\$colname\\\\building\\\\*\\\" \\\"$gsdl\\\\collect\\\\$colname\\\\index\\\\\\\" >>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 347 348 if($email) { 348 349 $toaddr =~ s/\@/\\\@/g; 349 350 $fromaddr =~ s/\@/\\\@/g; 350 $ecmd = "\\\"$gsdl\\\\bin\\\\windows\\\\perl\\\\bin\\\\perl.exe\\\" -S \\\"$gsdl\\\\bin\\\\script\\\\sendmail.pl\\\" -to $toaddr -from $fromaddr -smtp $smtp -msgfile \\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" -subject \\\"Results of build for collection $colname\\\" >>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\$logfile\\\" ";351 352 $ecmd2 = "\\\"$gsdl\\\\bin\\\\windows\\\\perl\\\\bin\\\\perl.exe\\\" -S \\\"$gsdl\\\\bin\\\\script\\\\sendmail.pl\\\" -to $toaddr -from $fromaddr -smtp $smtp -msgfile \\\"$gsdl\\\\etc\\\\cronlock.txt\\\" -subject \\\"Results of build for collection $colname\\\" >>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\ $logfile\\\" ";351 $ecmd = "\\\"$gsdl\\\\bin\\\\windows\\\\perl\\\\bin\\\\perl.exe\\\" -S \\\"$gsdl\\\\bin\\\\script\\\\sendmail.pl\\\" -to $toaddr -from $fromaddr -smtp $smtp -msgfile \\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" -subject \\\"Results of build for collection $colname\\\" >>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 352 353 $ecmd2 = "\\\"$gsdl\\\\bin\\\\windows\\\\perl\\\\bin\\\\perl.exe\\\" -S \\\"$gsdl\\\\bin\\\\script\\\\sendmail.pl\\\" -to $toaddr -from $fromaddr -smtp $smtp -msgfile \\\"$gsdl\\\\etc\\\\cronlock.txt\\\" -subject \\\"Results of build for collection $colname\\\" >>\\\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\\\" "; 353 354 } 354 355 } … … 372 373 print $nf "\$ENV{'PATH'}=\"$path\"\;\n"; 373 374 375 print $nf "\$logfile = \"cron\".time\(\).\".txt\"\;\n"; 376 374 377 if($os =~ /^windows$/) { 375 378 print $nf "if\(-e \\\"$gsdl\\\\collect\\\\$colname\\\\etc\\\\cron.lck\\\" \"\)\{ \n"; … … 381 384 } 382 385 else { 383 print $nf " system(\"more \"$gsdl/etc/cronlock.txt\" >\"$gsdl/collect/$colname/log/$logfile\"\"\)\;\n"; 386 if($os eq "windows") { 387 print $nf " system(\"more \"$gsdl\\\\etc\\\\cronlock.txt\" >\"$gsdl\\\\collect\\\\$colname\\\\log\\\\\$logfile\"\"\)\;\n"; 388 } else { 389 print $nf " system(\"more $gsdl/etc/cronlock/txt > $gsdl/collect/$colname/log/\$logfile \"\)\;\n"; 390 } 384 391 385 392 } … … 396 403 print $nf "system(\"echo lock \>\\\"$gsdl\\\\collect\\\\$colname\\\\etc\\\\cron.lck\\\"\")\;\n"; 397 404 } else { 398 print $nf "system(\"echo lock > \\\"$gsdl/collect/$colname/etc/cron.lck\\\"\")\;\n";405 print $nf "system(\"echo lock >$gsdl/collect/$colname/etc/cron.lck\")\;\n"; 399 406 } 400 407 … … 530 537 531 538 539 my $shortf = Win32::GetShortPathName($gsdl); 540 541 my $command = "$shortf\\bin\\windows\\silentstart $shortf\\bin\\windows\\perl\\bin\\perl $shortf\\collect\\$colname\\cron.pl\n"; 542 532 543 if($action =~ /^add$/ || $action =~ /^update$/) 533 544 { … … 536 547 537 548 if($frequency eq "hourly") { 538 print $nf "50 * * * * silentstart.exe $gsdl\\collect\\$colname\\cron.pl\n";549 print $nf "50 * * * * $command"; 539 550 } 540 551 elsif($frequency eq "daily") { 541 print $nf "00 0 * * * silentstart.exe $gsdl\\collect\\$colname\\cron.pl\n";552 print $nf "00 0 * * * $command"; 542 553 } 543 554 elsif($frequency eq "weekly") { 544 print $nf "59 11 * * 0 silentstart.exe $gsdl\\collect\\$colname\\cron.pl\n";555 print $nf "59 11 * * 0 $command"; 545 556 } 546 557 close($nf); … … 548 559 549 560 } else { 561 562 my $shortf = Win32::GetShortPathName($gsdl); 563 564 my $command = "$shortf\\bin\\windows\\silentstart $shortf\\bin\\windows\\perl\\bin\\perl $shortf\\collect\\$colname\\cron.pl\n"; 565 566 550 567 if($action =~ /^add$/ || $action =~ /^update$/) 551 568 { … … 553 570 (&gsprintf(STDERR, "{common.cannot_open_output_file}: $!\n", $out) && die); 554 571 if($frequency eq "hourly") { 555 print $nf "50 * * * * silentstart.exe $gsdl\\collect\\$colname\\cron.pl\n";572 print $nf "50 * * * * $command"; 556 573 } 557 574 elsif($frequency eq "daily") { 558 print $nf "00 0 * * * silentstart.exe $gsdl\\collect\\$colname\\cron.pl\n";575 print $nf "00 0 * * * $command"; 559 576 } 560 577 elsif($frequency eq "weekly") { 561 print $nf "59 11 * * 0 silentstart.exe $gsdl\\collect\\$colname\\cron.pl\n";578 print $nf "59 11 * * 0 $command"; 562 579 } 563 580
Note:
See TracChangeset
for help on using the changeset viewer.